提交 d9920dfc 编写于 作者: xignzi006's avatar xignzi006 🇨🇳

更新 %API%SecurityConfig.java.ftl

上级 c0066feb
...@@ -6,7 +6,6 @@ package ${pub.getPKGCodeName()}.${item.getCodeName()?lower_case}.config; ...@@ -6,7 +6,6 @@ package ${pub.getPKGCodeName()}.${item.getCodeName()?lower_case}.config;
import ${pub.getPKGCodeName()}.util.security.AuthenticationEntryPoint; import ${pub.getPKGCodeName()}.util.security.AuthenticationEntryPoint;
import ${pub.getPKGCodeName()}.util.security.AuthorizationTokenFilter; import ${pub.getPKGCodeName()}.util.security.AuthorizationTokenFilter;
import ${pub.getPKGCodeName()}.util.service.AuthenticationUserService; import ${pub.getPKGCodeName()}.util.service.AuthenticationUserService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
...@@ -60,7 +59,7 @@ public class ${item.codeName}SecurityConfig extends WebSecurityConfigurerAdapter ...@@ -60,7 +59,7 @@ public class ${item.codeName}SecurityConfig extends WebSecurityConfigurerAdapter
private String previewpath; private String previewpath;
@Value("${r'${ibiz.auth.excludesPattern:}"'}) @Value("${r'${ibiz.auth.excludesPattern:}"'})
private String excludesPattern; private String[] excludesPattern;
@Autowired @Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
...@@ -127,11 +126,9 @@ public class ${item.codeName}SecurityConfig extends WebSecurityConfigurerAdapter ...@@ -127,11 +126,9 @@ public class ${item.codeName}SecurityConfig extends WebSecurityConfigurerAdapter
.antMatchers("/"+uploadpath).permitAll() .antMatchers("/"+uploadpath).permitAll()
.antMatchers("/"+previewpath+"/**").permitAll(); .antMatchers("/"+previewpath+"/**").permitAll();
if (StringUtils.isNotBlank(excludesPattern)) { for (String excludePattern : excludesPattern) {
for (String excludePattern : excludesPattern.split("\\s*,\\s*")) { authenticationTokenFilter.addExcludePattern(excludePattern);
authenticationTokenFilter.addExcludePattern(excludePattern); httpSecurity.authorizeRequests().antMatchers(excludePattern).permitAll();
httpSecurity.authorizeRequests().antMatchers(excludePattern).permitAll();
}
} }
// 所有请求都需要认证 // 所有请求都需要认证
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册