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