I have a single method that I want to allow both anonymous and authenticated access to.
I am using Spring Security 3.2.4 with java based configuration.
The o
Need to add .annonymous()
http
.addFilterBefore(muiltpartFilter, ChannelProcessingFilter.class)
.addFilterBefore(cf, ChannelProcessingFilter.class)
.anonymous().and()
.authorizeRequests().anyRequest().authenticated().and()
.authorizeRequests()
.antMatchers("/ping**")
.permitAll()
.and()
.formLogin()
.loginPage("/login")
.permitAll()
.and()
.logout()
.logoutUrl("/logout")
.logoutSuccessUrl("/login");
Referred from: https://stackoverflow.com/a/25280897/256245