0
joe@tronactive.com created
- ABP Framework version: v7.4.1
- UI Type: Blazor Server
- Database System: EF Core SQL Server
- Tiered (for MVC) or Auth Server Separated (for Angular): no
How would I get access to the ExternalProviders settings within my BlazorModule? I want to use the settings to configure the AzureOpenId external provder instead of keeping them in appsettings.json likle I am below.
context.Services.AddAuthentication()
.AddOpenIdConnect("AzureOpenId", "Azure AD", options =>
{
options.ResponseType = OpenIdConnectResponseType.CodeIdToken;
options.RequireHttpsMetadata = false;
options.SaveTokens = true;
options.GetClaimsFromUserInfoEndpoint = true;
options.Scope.Add("email");
options.Scope.Add("openid");
options.Scope.Add("profile");
options.Scope.Add("User.Read");
options.ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "sub");
options.CallbackPath = "/signin-azuread-oidc";
options.Authority = configuration["AzureAd:Authority"];
options.ClientId = configuration["AzureAd:ClientId"];
options.ResponseType = OpenIdConnectResponseType.CodeIdToken;
options.CallbackPath = "/signin-azuread-oidc";
options.ClientSecret = configuration["AzureAd:ClientSecret"];
});
3 Answer(s)
-
0
-
0
No I just want to call the AbpSettings and get the stored AzureOpenId settings so I can insert them into the above options section.
-
0
hi
You can add a
IPostConfigureOptions
service and inject the services in it.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<OpenIdConnectOptions>, YourOpenIdConnectPostConfigureOptions>());
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options?view=aspnetcore-7.0#options-post-configuration
https://github.com/dotnet/aspnetcore/blob/release/7.0/src/Security/Authentication/OpenIdConnect/src/OpenIdConnectPostConfigureOptions.cs#L16