问题:继承FilterSecurityInterceptor自定义Spring security拦截器,但是每次都拦截了css等静态资源,应该如何设置?
@Override
protected void configure(HttpSecurity http) throws Exception{
http
.authorizeRequests()
.anyRequest().authenticated()
.and()
// 登录地址,成功跳转地址,登陆失败地址
.formLogin().loginPage("/login")
.defaultSuccessUrl("/",true)
.failureUrl("/login?error")
// 授予所有用户以上地址的访问权限
.permitAll();
// 设置可以iframe访问
http.headers().frameOptions().sameOrigin();
}
本文介绍如何在Spring Security中配置HttpSecurity以避免拦截css等静态资源,通过使用authorizeRequests方法并结合antMatchers来实现静态资源放行。

2484

被折叠的 条评论
为什么被折叠?



