diff --git a/hawkbit-runtime/hawkbit-update-server/src/main/java/org/eclipse/hawkbit/app/Start.java b/hawkbit-runtime/hawkbit-update-server/src/main/java/org/eclipse/hawkbit/app/Start.java index 13ae640b4c..22a97b96a0 100644 --- a/hawkbit-runtime/hawkbit-update-server/src/main/java/org/eclipse/hawkbit/app/Start.java +++ b/hawkbit-runtime/hawkbit-update-server/src/main/java/org/eclipse/hawkbit/app/Start.java @@ -12,6 +12,12 @@ import org.eclipse.hawkbit.autoconfigure.security.EnableHawkbitManagedSecurityConfiguration; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; +import org.springframework.web.servlet.view.RedirectView; /** * A {@link SpringBootApplication} annotated class with a main method to start. @@ -35,4 +41,22 @@ public class Start { public static void main(final String[] args) { SpringApplication.run(Start.class, args); } + + @Controller + public static class RedirectController { + + @GetMapping("/") + public RedirectView redirectToSwagger( + RedirectAttributes attributes) { + attributes.addFlashAttribute("flashAttribute", "redirectWithRedirectView"); + attributes.addAttribute("attribute", "redirectWithRedirectView"); + return new RedirectView("swagger-ui/index.html"); + } + } + + @Configuration + @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true, proxyTargetClass = true) + public static class MethodSecurityConfig { + + } }