I am using Thymeleaf in the interface layer. I want to prohibit login and register pages when user is logged in. Is there any solution to this?
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/persons/**","/animals/**","/animal/**","/person/**")
.hasRole("USER")
.antMatchers("/**")
.permitAll()
.and()
.formLogin()
.loginPage("/login")
.loginProcessingUrl("/dologin")
.defaultSuccessUrl("/persons")
.and()
.logout()
.logoutUrl("/logout")
.logoutSuccessUrl("/login")
.and()
.csrf()
.disable();
}