具有弹簧安全配置:
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")
}
似乎已经足够了,但我仍然不知道它是否是推荐的方式