Ver código fonte

增加开放配置

zengxj 6 anos atrás
pai
commit
936677d4ab

+ 6 - 2
src/main/java/edu/math/diagnosis/config/WebSecurityConfig.java

@@ -19,6 +19,7 @@ import org.springframework.security.web.authentication.WebAuthenticationDetailsS
 import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
 
 import javax.annotation.Resource;
+import java.util.Arrays;
 
 /**
  * @AUTHOR: DaiFengWen
@@ -40,6 +41,9 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
     @Value("${web.logoutUrl:/logout}")
     private String logoutUrl;
 
+    @Value("${web.permitUrls:/**/*.png}")
+    private String[] permitUrls;
+
     @Override
     @Bean
     public UserDetailsService userDetailsService() { //覆盖写userDetailsService方法 (1)
@@ -126,8 +130,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
     public void configure(WebSecurity web) throws Exception {
         web.ignoring().antMatchers("/resources/**", "/static/**", "/**.js");
         web.ignoring().antMatchers(uploadProperties.getUploadPattern());
-        web.ignoring().antMatchers("/**/*.js", "/lang/*.json", "/**/*.css", "/**/*.map", "/**/*.png", "/**/*.jpg","/**/*.woff","/**/*.ttf");
-//        web.ignoring().antMatchers("/fonts/**");
+        web.ignoring().antMatchers("/**/*.js", "/lang/*.json", "/**/*.css", "/**/*.map", "/**/*.png", "/**/*.jpg","/**/*.woff","/**/*.ttf","/*.ico");
+        web.ignoring().antMatchers(permitUrls);
         web.ignoring().antMatchers("/open/**");
         web.ignoring().antMatchers("/v2/api-docs",//swagger api json
                 "/swagger-resources/configuration/ui",//用来获取支持的动作

+ 2 - 1
src/main/resources/application.properties

@@ -36,4 +36,5 @@ spring.data.redis.repositories.enabled=false
 #ÆôÓÃswagger
 swagger.enabled=true
 web.loginPage=/login
-web.logoutUrl=/logout
+web.logoutUrl=/logout
+web.permitUrls=/**/*.png