I have configured a Spring Security on my app as shown below but whenever we call the URL for RequestMapping POST method, it always redirects us back to Login page (Note we are logged in as ADMIN). Am I missing something?
@Override
protected void configure(HttpSecurity http) throws Exception{
http.authorizeRequests()
.antMatchers("/validate").hasAnyRole(USER.name(), ADMIN.name())
.antMatchers("/Registration","/Confirmation").hasAnyRole(USER.name(),ADMIN.name())
.antMatchers("/").permitAll()
.anyRequest().hasRole(ADMIN.name())
.and()
.formLogin()
.loginPage("/login")
.defaultSuccessUrl("/validate")
.permitAll()
.and()
.sessionManagement()
.invalidSessionUrl("/login");