自定义AbstractSecurityInterceptor这个类后,所有的URL都会被过滤进去,在里面进行判断,即使配置了web.ignoring()或者

sam204447118 sam204447118 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
最近配置Spring Security,跟着博客上的demo学习了一下,但是自定义AbstractSecurityInterceptor这个类后,所有的URL都会被过滤进去,在里面进行判断,即使配置了web.ignoring()或者antMatchers().permitAll()都没效果,有什么办法解决这个问题呢

@Override
protected void configure(HttpSecurity http) throws Exception {
// super.configure(http);
http
.authorizeRequests()
.antMatchers("/", "/test1", "/test2", "/login", "/register/**", "/webjars/**").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.permitAll()
// .failureUrl("login?error=true")
.successHandler(new MySuccessHandler())
.defaultSuccessUrl("/admin/index")
.and()
.logout()
.logoutSuccessUrl("/")
.and()
// .csrf().disable()
.rememberMe()
;

http.addFilterAfter(myFilterSecurityInterceptor, FilterSecurityInterceptor.class);
}



...全文

相关推荐

评论 3
收藏 已收藏
分享
返回顶部
sam204447118
Web 开发 81,107 成员 341,720 内容