Explorar el Código

Merge branch 'lyy_fix_springSecurityWithJwt' of WengPuHong/seecoder-devcloud into master

LiuYiYe hace 5 años
padre
commit
24c3b9636f

+ 15 - 11
web/src/main/java/cn/seecoder/web/infrastructure/config/WebSecurityConfig.java

@@ -22,8 +22,8 @@ import cn.seecoder.web.infrastructure.security.WebSecurityConstants;
  * @date 2021/3/5
  * @description:
  */
-@Configuration
-@EnableWebSecurity
+    @Configuration
+    @EnableWebSecurity
 @EnableGlobalMethodSecurity(prePostEnabled = true)  //  启用方法级别的权限认证
 //@DependsOn("userServiceImpl")
 public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@@ -44,16 +44,20 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
         //访问控制
         http
                 //访问swagger
-                .anonymous()
-                .authorities("ROLE_ANONYMOUS").and()
-                .authorizeRequests()
-                .antMatchers("/**/*swagger*/**").permitAll()
-                .antMatchers("/**/*api-docs*/**").permitAll()
-                .antMatchers("/**/hook").permitAll()
-                .antMatchers("/**/query/**").permitAll()
-
-                .and()
+//                .anonymous()
+//                .authorities("ROLE_ANONYMOUS").and()
                 .authorizeRequests()
+//                .antMatchers("/**/*swagger*/**").permitAll()
+//                .antMatchers("/**/*api-docs*/**").permitAll()
+//                .antMatchers("/**/hook").permitAll()
+//                .antMatchers("/**/query/**").permitAll()
+                .antMatchers("/**/*swagger*/**").anonymous()
+                .antMatchers("/**/*api-docs*/**").anonymous()
+                .antMatchers("/**/hook").anonymous()
+                .antMatchers("/**/query/**").anonymous()
+//
+//                .and()
+//                .authorizeRequests()
                 // API Test Controller
                 .antMatchers(HttpMethod.GET, "/api/test/list/{projectId}").access("@authTools.checkProjOwnership(#projectId)")
                 .antMatchers(HttpMethod.GET, "/api/test/delete/{testId}").access("@authTools.checkTestOwnership(#testId)")