I have my WebSecurityConfigurerAdapter configure() method
http.authorizeRequests().antMatchers("/static/**").permitAll().anyRequest().authenticated().and()
.formLogin().loginPage("/login")
// Redirection after login
.defaultSuccessUrl("/home", true).permitAll().and().logout()
// logout link. Check if there is no conflict with SAML
.logoutRequestMatcher(new AntPathRequestMatcher("/saml/logout")).deleteCookies("JSESSIONID")
.invalidateHttpSession(true).logoutSuccessUrl("/").permitAll();
How do I redirect a logged in user to /home if user tries to access /login ?
PS - My controller code
@RequestMapping(method = RequestMethod.GET, value = {"/login"})
public String getIndexPage() {
return LOGIN_PAGE;
}
@RequestMapping(method = RequestMethod.GET, value = {"/"})
public String getHomePage() {
return "redirect:/home";
}