From 4a0caa1079a9022bd5db7dc93018ae2b39272f44 Mon Sep 17 00:00:00 2001 From: xRain Date: Tue, 12 May 2026 10:08:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86SimApiAuthGateClient?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AuthGate/SimApiAuthGateClient.cs | 6 ++++-- Configurations/SimApiAuthGateOptions.cs | 1 + SimApiExtensions.cs | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/AuthGate/SimApiAuthGateClient.cs b/AuthGate/SimApiAuthGateClient.cs index c3776d5..a41929f 100644 --- a/AuthGate/SimApiAuthGateClient.cs +++ b/AuthGate/SimApiAuthGateClient.cs @@ -1,9 +1,11 @@ -using SimApi.Configurations; +using Microsoft.Extensions.Logging; +using SimApi.Configurations; using SimApi.Helpers; namespace SimApi.AuthGate; -public class SimApiAuthGateClient(SimApiOptions apiOptions) : SimApiHttpClient +public class SimApiAuthGateClient(SimApiOptions apiOptions, ILogger logger) + : SimApiHttpClient(apiOptions, logger) { public override string Server { get; init; } = apiOptions.SimApiAuthGateOptions.Server ?? string.Empty; public override string AppId { get; init; } = apiOptions.SimApiAuthGateOptions.AppId ?? string.Empty; diff --git a/Configurations/SimApiAuthGateOptions.cs b/Configurations/SimApiAuthGateOptions.cs index c2563d2..2997dd9 100644 --- a/Configurations/SimApiAuthGateOptions.cs +++ b/Configurations/SimApiAuthGateOptions.cs @@ -11,4 +11,5 @@ public class SimApiAuthGateOptions /// 注意: 只有内部应用需要开启这个,也就是api通过内部网关代理后 /// public bool UseMiddleware { get; set; } + public bool UseIam { get; set; } } \ No newline at end of file diff --git a/SimApiExtensions.cs b/SimApiExtensions.cs index e83347a..e0988f7 100644 --- a/SimApiExtensions.cs +++ b/SimApiExtensions.cs @@ -333,7 +333,10 @@ public static class SimApiExtensions { builder.AddSingleton(); builder.AddSingleton(); - builder.AddSingleton(); + if (simApiOptions.SimApiAuthGateOptions.UseIam) + { + builder.AddSingleton(); + } } builder.AddSingleton(simApiOptions);