【发布时间】:2017-06-11 01:56:30
【问题描述】:
我想避免在用户请求静态资源(如 css 文件)时创建会话。然而,即使在告诉 WebSecurity 忽略这个静态资源路径之后,我注意到来自我的 SpringBoot 应用程序的所有响应仍然具有 JSESSIONID cookie。为什么?
public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers("/css/**");
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.formLogin()
.loginPage("/login")
.loginProcessingUrl("/login")
.and()
.authorizeRequests()
.antMatchers(HttpMethod.GET, "/login", "/error").permitAll()
.anyRequest().authenticated(); //all other pages require users to be authenticated
}
我正在使用 Spring Security 来保护我的应用程序....但是对于对这些静态资源的请求,我不希望创建或验证会话。
【问题讨论】:
标签: spring session spring-security