From b131f033c12459b718565cab504f762c25642d2d Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期一, 06 一月 2025 15:23:08 +0800 Subject: [PATCH] 模型运行 --- 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