修复了SimApiAuthGateClient初始化BUG

This commit is contained in:
2026-05-12 10:08:00 +08:00
parent 7a2ff896b2
commit 4a0caa1079
3 changed files with 9 additions and 3 deletions
+4 -2
View File
@@ -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<SimApiAuthGateClient> 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;
+1
View File
@@ -11,4 +11,5 @@ public class SimApiAuthGateOptions
/// 注意: 只有内部应用需要开启这个,也就是api通过内部网关代理后
/// </summary>
public bool UseMiddleware { get; set; }
public bool UseIam { get; set; }
}
+4 -1
View File
@@ -333,7 +333,10 @@ public static class SimApiExtensions
{
builder.AddSingleton<SimApiAuthGateClient>();
builder.AddSingleton<SimApiAuthGate>();
builder.AddSingleton<SimApiIam>();
if (simApiOptions.SimApiAuthGateOptions.UseIam)
{
builder.AddSingleton<SimApiIam>();
}
}
builder.AddSingleton(simApiOptions);