Update SecurityConfig.java

This commit is contained in:
macro
2021-12-15 19:20:48 +08:00
parent 360990fd0c
commit 9a23fd811a

View File

@@ -31,14 +31,14 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
protected void configure(HttpSecurity httpSecurity) throws Exception {
ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry = httpSecurity
.authorizeRequests();
//不需要保护的资源路径允许访问
// 不需要保护的资源路径允许访问
for (String url : ignoreUrlsConfig().getUrls()) {
registry.antMatchers(url).permitAll();
}
//允许跨域请求的OPTIONS请求
// 允许跨域的OPTIONS请求
registry.antMatchers(HttpMethod.OPTIONS)
.permitAll();
// 任何请求需要身份认证
// 其他任何请求需要身份认证
registry.and()
.authorizeRequests()
.anyRequest()