From aa0382e44311f9f7e62a688c8fcaa9c69a512e0f Mon Sep 17 00:00:00 2001
From: dengzedong <dengzedong@email>
Date: 星期二, 24 十二月 2024 15:15:10 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 iailab-framework/iailab-common-security/src/main/java/com/iailab/framework/security/config/IailabSecurityAutoConfiguration.java |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/iailab-framework/iailab-common-security/src/main/java/com/iailab/framework/security/config/IailabSecurityAutoConfiguration.java b/iailab-framework/iailab-common-security/src/main/java/com/iailab/framework/security/config/IailabSecurityAutoConfiguration.java
index 46c63a3..4ab66ee 100644
--- a/iailab-framework/iailab-common-security/src/main/java/com/iailab/framework/security/config/IailabSecurityAutoConfiguration.java
+++ b/iailab-framework/iailab-common-security/src/main/java/com/iailab/framework/security/config/IailabSecurityAutoConfiguration.java
@@ -1,5 +1,6 @@
 package com.iailab.framework.security.config;
 
+import cn.hutool.extra.spring.SpringUtil;
 import com.iailab.framework.security.core.aop.PreAuthenticatedAspect;
 import com.iailab.framework.security.core.context.TransmittableThreadLocalSecurityContextHolderStrategy;
 import com.iailab.framework.security.core.filter.TokenAuthenticationFilter;
@@ -10,6 +11,7 @@
 import com.iailab.framework.web.core.handler.GlobalExceptionHandler;
 import com.iailab.module.system.api.oauth2.OAuth2TokenApi;
 import com.iailab.module.system.api.permission.PermissionApi;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.beans.factory.config.MethodInvokingFactoryBean;
 import org.springframework.boot.autoconfigure.AutoConfiguration;
 import org.springframework.boot.autoconfigure.AutoConfigureOrder;
@@ -80,11 +82,23 @@
     @Bean
     public TokenAuthenticationFilter authenticationTokenFilter(GlobalExceptionHandler globalExceptionHandler,
                                                                OAuth2TokenApi oauth2TokenApi) {
+        try {
+            OAuth2TokenApi oAuth2TokenApi = SpringUtil.getBean("aAuth2TokenApiImpl", OAuth2TokenApi.class);
+            if (oAuth2TokenApi != null) {
+                oauth2TokenApi = oAuth2TokenApi;
+            }
+        } catch (Exception ignored) {}
         return new TokenAuthenticationFilter(securityProperties, globalExceptionHandler, oauth2TokenApi);
     }
 
     @Bean("ss") // 使用 Spring Security 的缩写,方便使用
     public SecurityFrameworkService securityFrameworkService(PermissionApi permissionApi) {
+        try {
+            PermissionApi permissionApiImpl = SpringUtil.getBean("permissionApiImpl", PermissionApi.class);
+            if (permissionApiImpl != null) {
+                permissionApi = permissionApiImpl;
+            }
+        } catch (Exception ignored) {}
         return new SecurityFrameworkServiceImpl(permissionApi);
     }
 

--
Gitblit v1.9.3