0
我在我的spring启动项目中使用basicAuth
。SpringBoot basic auth忽略以.wsdl结尾的URL
需要验证服务URL,而在WSDL上应该没有验证。
我想保留application.yml
文件中被忽略的所有URL &。
喜欢的东西:
auth.authenticated: /onlineshop/v1/ecart,/onlineshop/v1/wishlist
auth.ignored: /onlineshop/v1/ecart.wsdl,/onlineshop/v1/wishlist.wsdl
@EnableWebSecurity
@Configuration
class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Value("${auth.authenticated}")
String[] allAuthenticated;
@Value("${auth.ignored}")
String[] allIgnored;
@Override
protected void configure(HttpSecurity http) throws Exception {
// Something like
for (String ignored: allIgnored) {
http.authorizeRequests().antMatchers(ignored).permitAll();
}
// Something like
for (String authenticated: allAuthenticated) {
http.authorizeRequests().antMatchers(authenticated).authenticated();
}
....
}
}
上面的代码是一个粗略的草稿(对不起那个),但我已经试过沿着这些线路编码,但它无法正常工作。
它没有应用任何形式的验证。
请建议我该如何完成这项工作。
此外,而不是忽略结束的.wsdl选择的网址,我怎么能忽略与的.wsdl
结尾的所有网址,谢谢您
刚才看到你给出了同样的评论,我把它放入一个答案。让我们补偿;-) – GhostCat