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);