Przeglądaj źródła

:bug: 修复 BUG:修复放行url配置不生效的问题

lishangbu 6 lat temu
rodzic
commit
a7d86c8541

+ 2 - 0
pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/BaseResourceServerConfigurerAdapter.java

@@ -19,6 +19,7 @@ package com.pig4cloud.pigx.common.security.component;
 
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
 import org.springframework.security.config.annotation.web.builders.HttpSecurity;
 import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
 import org.springframework.security.core.userdetails.UserDetailsService;
@@ -37,6 +38,7 @@ import org.springframework.web.client.RestTemplate;
  * 2. 支持 获取用户全部信息
  */
 @Slf4j
+@Configuration
 public class BaseResourceServerConfigurerAdapter extends ResourceServerConfigurerAdapter {
 	@Autowired
 	protected ResourceAuthExceptionEntryPoint resourceAuthExceptionEntryPoint;

+ 6 - 1
pigx-config/src/main/resources/config/application-dev.yml

@@ -98,6 +98,11 @@ swagger:
 ## spring security 配置
 security:
   oauth2:
+    client:
+      # 默认放行url,如果子模块重写这里的配置就会被覆盖
+      ignore-urls:
+        - '/actuator/**'
+        - '/v2/api-docs'
     resource:
       loadBalanced: true
       token-info-uri: http://pigx-auth/oauth/check_token
@@ -105,5 +110,5 @@ security:
 # log配置
 logging:
   level:
-    root: warn
+    root: error
     com.pig4cloud.pigx: info

+ 2 - 0
pigx-config/src/main/resources/config/pigx-activiti-dev.yml

@@ -6,6 +6,8 @@ security:
       client-secret: ENC(gPFcUOmJm8WqM3k3eSqS0Q==)
       scope: server
       ignore-urls:
+        - '/actuator/**'
+        - '/v2/api-docs'
         - '/service/**'
         - '/editor-app/**'
         - '/task/view/*'

+ 0 - 4
pigx-config/src/main/resources/config/pigx-codegen-dev.yml

@@ -5,10 +5,6 @@ security:
       client-id: ENC(gPFcUOmJm8WqM3k3eSqS0Q==)
       client-secret: ENC(gPFcUOmJm8WqM3k3eSqS0Q==)
       scope: server
-      ignore-urls:
-        - '/actuator/**'
-        - '/v2/api-docs'
-
 # 数据源配置
 spring:
   datasource:

+ 0 - 3
pigx-config/src/main/resources/config/pigx-daemon-dev.yml

@@ -5,9 +5,6 @@ security:
       client-id: ENC(tz2NM4GcmnE7sNJTYL8ZSg==)
       client-secret: ENC(tz2NM4GcmnE7sNJTYL8ZSg==)
       scope: server
-      ignore-urls:
-        - '/actuator/**'
-        - '/v2/api-docs'
 ## 定时任务
 spring:
   # 保存定时任务的数据源

+ 1 - 0
pigx-config/src/main/resources/config/pigx-upms-dev.yml

@@ -5,6 +5,7 @@ security:
       client-id: ENC(ltJPpR50wT0oIY9kfOe1Iw==)
       client-secret: ENC(ltJPpR50wT0oIY9kfOe1Iw==)
       scope: server
+      # 默认放行url,子模块重写时application-dev.yml中的公共配置会被覆盖,所以要把公共配置中的放行url再写一次
       ignore-urls:
         - '/actuator/**'
         - '/v2/api-docs'