Spring security 允许一些没有安全性的URL

Spring security 允许一些没有安全性的URL,spring-security,Spring Security,实际上,我想在没有安全性的情况下授权每个URL,因此在扩展websecurityConfigureAdapter的类中 @覆盖 受保护的无效配置(HttpSecurity http)引发异常{ http .cors().configurationSource(请求->新建CorsConfiguration().applyPermitDefaultValues()) .和()/(1) .授权请求() .antMatchers(HttpMethod.DELETE,“/v1/billingaccoun

实际上,我想在没有安全性的情况下授权每个URL,因此在扩展
websecurityConfigureAdapter
的类中

@覆盖
受保护的无效配置(HttpSecurity http)引发异常{
http
.cors().configurationSource(请求->新建CorsConfiguration().applyPermitDefaultValues())
.和()/(1)
.授权请求()
.antMatchers(HttpMethod.DELETE,“/v1/billingaccount/*”).permitAll()
.antMatchers(“/actuator/**”).permitAll()
.antMatchers(“/v2/api文档”).permitAll()
.及()
.授权请求()
.anyRequest().authenticated()/(2)
.及()
.oauth2ResourceServer().jwt()/(3)
.jwtAuthenticationConverter(jwtAuthenticationConverter());
}
我试着通过邮递员进行
DELETE

http://localhost:8083/v1/billingaccount/1003
我得到一个401错误

没问题

http://localhost:8083/v2/api-docs

您需要有两个星号(*)


.antMatchers(HttpMethod.DELETE,“/v1/billingaccount/**”).permitAll()

您是否从包
org.springframework.http
导入了
HttpMethod
?并删除了第二个
授权请求()
这不是必需的。