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

更新 %API%SecurityConfig.java.ftl

上级 72171bbc
...@@ -58,6 +58,9 @@ public class ${item.codeName}SecurityConfig extends WebSecurityConfigurerAdapter ...@@ -58,6 +58,9 @@ public class ${item.codeName}SecurityConfig extends WebSecurityConfigurerAdapter
@Value("${r'${ibiz.file.previewpath:ibizutil/preview}"'}) @Value("${r'${ibiz.file.previewpath:ibizutil/preview}"'})
private String previewpath; private String previewpath;
@Value("${r'${ibiz.auth.excludesPattern:}"'})
private String excludesPattern;
@Autowired @Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth auth
...@@ -122,8 +125,16 @@ public class ${item.codeName}SecurityConfig extends WebSecurityConfigurerAdapter ...@@ -122,8 +125,16 @@ public class ${item.codeName}SecurityConfig extends WebSecurityConfigurerAdapter
.antMatchers("/"+downloadpath+"/**").permitAll() .antMatchers("/"+downloadpath+"/**").permitAll()
.antMatchers("/"+uploadpath).permitAll() .antMatchers("/"+uploadpath).permitAll()
.antMatchers("/"+previewpath+"/**").permitAll() .antMatchers("/"+previewpath+"/**").permitAll()
if (StringUtils.isNotBlank(excludesPattern)) {
for (String excludePattern : excludesPattern.split("\\s*,\\s*")) {
authenticationTokenFilter.addExcludePattern(excludePattern);
httpSecurity.authorizeRequests().antMatchers(excludePattern).permitAll();
}
}
// 所有请求都需要认证 // 所有请求都需要认证
.anyRequest().authenticated() httpSecurity.authorizeRequests().anyRequest().authenticated()
// 防止iframe 造成跨域 // 防止iframe 造成跨域
.and().headers().frameOptions().disable(); .and().headers().frameOptions().disable();
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册