Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Vaadin-Spring-Security redirect to correct view after login
I have configured my Vaadin/Spring Boot application to redirect to a separate login page (located on its own UI) if the user is not logged in.
After the login, i want the user to be redirected back to the page he originally tried to access (e.g. by opening a bookmark).
In my WebSecurityConfigAdapter i use the SavedRequestAwareVaadinAuthenticationSuccessHandler. This has two problems however:
1. query parameters are not restored. For example, the user tries to go to http://localhost:9002/content#!/news.
He will be redirected to http://localhost:9002/login#!/news.
After the successful redirect, he is redirected to http://localhost:9002/content#!/ when he should be redirected to http://localhost:9002/content#!/news.
2. If the user access the login page directly, http://localhost:9002/login, i want him to be redirected to http://localhost:9002/content
@Bean(name = VaadinSharedSecurityConfiguration.VAADIN_AUTHENTICATION_SUCCESS_HANDLER_BEAN)
VaadinAuthenticationSuccessHandler vaadinAuthenticationSuccessHandler(HttpService httpService,
VaadinRedirectStrategy vaadinRedirectStrategy) {
SavedRequestAwareVaadinAuthenticationSuccessHandler successHandler = new SavedRequestAwareVaadinAuthenticationSuccessHandler(
httpService, vaadinRedirectStrategy, "/");
return successHandler;
}