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

更新 %API%SecurityConfig.java.ftl

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