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

更新 %APP%SecurityConfig.java.ftl

上级 61c511f2
......@@ -56,6 +56,9 @@ public class ${app.getPKGCodeName()}SecurityConfig extends WebSecurityConfigurer
@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 {
......@@ -119,9 +122,15 @@ public class ${app.getPKGCodeName()}SecurityConfig extends WebSecurityConfigurer
// 文件操作
.antMatchers("/"+downloadpath+"/**").permitAll()
.antMatchers("/"+uploadpath).permitAll()
.antMatchers("/"+previewpath+"/**").permitAll()
// 所有请求都需要认证
.anyRequest().authenticated()
.antMatchers("/"+previewpath+"/**");
for (String excludePattern : excludesPattern) {
authenticationTokenFilter.addExcludePattern(excludePattern);
httpSecurity.authorizeRequests().antMatchers(excludePattern).permitAll();
}
// 所有请求都需要认证
httpSecurity.authorizeRequests().anyRequest().authenticated()
// 防止iframe 造成跨域
.and().headers().frameOptions().disable();
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册