Open Closed

How would I get access to the ExternalProviders settings within my BlazorModule #6095


User avatar
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"];
        });
Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

3 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Do you mean Dynamic ExternalProviders,

    It can't be used in ConfigureServices method.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    joe@tronactive.com created

    No I just want to call the AbpSettings and get the stored AzureOpenId settings so I can insert them into the above options section.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    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

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on October 05, 2026, 11:32
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.