具有带有以下内容的spring安全配置:
http.antMatcher("/**/v1/public/company/employees/**")
.authorizeRequests()
.antMatchers(HttpMethod.OPTIONS, "/**/v1/public/company/employees/A").permitAll()
.antMatchers(HttpMethod.POST, "/**/v1/public/company/employees/B").permitAll()
.antMatchers("/**/v1/public/company/employees/**")
.authenticated()
.and()
.csrf()
.disable()
.addFilterBefore(customFilter, AbstractPreAuthenticatedProcessingFilter.class);
我如何从customFilter
中排除公共端点(A和B)?
更新
使用:
@Override
public void configure(WebSecurity web) throws Exception {
web
.ignoring()
.antMatchers(HttpMethod.OPTIONS, "/**/v1/public/company/employees/A")
.antMatchers(HttpMethod.POST, "/**/v1/public/company/employees/B")
}
似乎足够,但是我仍然不知道这是否是推荐的方式
我已经尝试了您在更新中提供的解决方案,但对我来说它不起作用,我仍然收到401未经授权。