From ca120d70593f7a29a150bb6fb17f8ff4cdfadbc8 Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期三, 19 三月 2025 11:31:27 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/config/SdkAutoConfiguration.java | 47 ++++++++++++++++++++++++++++++++++++----------- 1 files changed, 36 insertions(+), 11 deletions(-) diff --git a/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/config/SdkAutoConfiguration.java b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/config/SdkAutoConfiguration.java index b9cf3fe..d8811da 100644 --- a/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/config/SdkAutoConfiguration.java +++ b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/config/SdkAutoConfiguration.java @@ -1,9 +1,9 @@ package com.iailab.sdk.auth.config; -import com.iailab.sdk.auth.client.IailabAuthClient; -import com.iailab.sdk.util.http.IailabHttpUtils; -import org.springframework.boot.context.properties.EnableConfigurationProperties; +import com.iailab.sdk.auth.factory.YamlPropertySourceFactory; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; import javax.annotation.PostConstruct; @@ -12,17 +12,42 @@ * SDK配置文件 */ @Configuration -@EnableConfigurationProperties(AuthProperties.class) +@PropertySource( + value = "classpath:application.yaml", + factory = YamlPropertySourceFactory.class // 使用自定义加载器 +) public class SdkAutoConfiguration { - private final AuthProperties authProperties; + @Value("${iailab.token.base-url}") + private String baseUrl; - public SdkAutoConfiguration(AuthProperties authProperties) { - this.authProperties = authProperties; - } + @Value("${iailab.token.tenant-id}") + public Long tenantId; + + @Value("${iailab.token.client-id}") + public String clientId; + + @Value("${iailab.token.client-secret}") + public String clientSecret; + + @Value("${iailab.token.username}") + public String username; + + public static String BASE_URL; + + public static Long TENANT_ID; + + public static String CLIENT_ID; + + public static String CLIENT_SECRET; + + public static String USERNAME; @PostConstruct - public void init() { - IailabAuthClient.setAuthProperties(authProperties); - IailabHttpUtils.setAuthProperties(authProperties); + public void initUrl() { + BASE_URL = this.baseUrl; + TENANT_ID = this.tenantId; + CLIENT_ID = this.clientId; + CLIENT_SECRET = this.clientSecret; + USERNAME = this.username; } } -- Gitblit v1.9.3