I have a J2EE REST-based web application that uses Spring Security 4.0.1.RELEASE. I am configuring Spring Security with a Java-based configuration and have set the session creation policy to STATELESS like so:
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(secureEnabled=true, prePostEnabled=true, jsr250Enabled=true, order=1)
public class DefaultSecurityBeansConfig extends WebSecurityConfigurerAdapter {
// ...
@Override
protected void configure(HttpSecurity http) throws Exception {
http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()...; // additional config omitted for brevity
// ...
}
// ...
}
After reading this article about Spring Security session management, I believe that the SessionManagementFilter
filter should not be running in Spring Security's filter chain. But it definitely is. I can set a breakpoint in that class's doFilter
method, and it is run on every request to the server.
What is going on here? The fact that this filter is running is causing other unexpected behavior in my app that I thought had been configured away.
Thanks.