Commit 9a23fd81 authored by macro's avatar macro
Browse files

Update SecurityConfig.java

parent 360990fd
...@@ -31,14 +31,14 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -31,14 +31,14 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
protected void configure(HttpSecurity httpSecurity) throws Exception { protected void configure(HttpSecurity httpSecurity) throws Exception {
ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry = httpSecurity ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry = httpSecurity
.authorizeRequests(); .authorizeRequests();
//不需要保护的资源路径允许访问 // 不需要保护的资源路径允许访问
for (String url : ignoreUrlsConfig().getUrls()) { for (String url : ignoreUrlsConfig().getUrls()) {
registry.antMatchers(url).permitAll(); registry.antMatchers(url).permitAll();
} }
//允许跨域请求的OPTIONS请求 // 允许跨域的OPTIONS请求
registry.antMatchers(HttpMethod.OPTIONS) registry.antMatchers(HttpMethod.OPTIONS)
.permitAll(); .permitAll();
// 任何请求需要身份认证 // 其他任何请求需要身份认证
registry.and() registry.and()
.authorizeRequests() .authorizeRequests()
.anyRequest() .anyRequest()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment