0

Is there any way to add external identity providers from database, and show the providers based on the user access?

I can add multiple external identity providers in startup.cs, but I want to load it from DB instead of static values like below

             .AddOpenIdConnect("AAD", "Login with Azure AD", options =>
             {
                 options.Authority = "https://login.windows.net/XXXXXXXX";
                 options.ClientId = "YYYYYYYYYYYYYYYYYYY";
                 options.ResponseType = "id_token";

                 options.TokenValidationParameters = new TokenValidationParameters { ValidateIssuer = false };

                 options.CallbackPath = "/signin-oidc";
             }).AddOpenIdConnect("id", "Login", options =>
             {
                 options.Authority = "https://login.windows.net/ZZZZZZZZZZ";
                 options.ClientId = "QQQQQQQQQQ";
                 options.ResponseType = "id_token";

                 options.TokenValidationParameters = new TokenValidationParameters { ValidateIssuer = false };

                 options.CallbackPath = "/signin-oidc";
             })

I have seen IIdentityProviderStore, but it was confusing becuase there was no options to set Authority and ClientId.

Thank you in advance!

roczstar
  • 43
  • 2
  • 6
  • _"Is there any way to add external identity providers from database, and show the providers based on the user access?"_ - May I ask why you want to do this? Do you _really_ have too many external IDPs for you to put in code? **and** all those IDPs comply with OIDC? (Because many IDPs that look like they're OIDC often end-up with you needing to use their own client-auth-libraries anyway - e.g. Google, Facebook, Apple, etc). – Dai Aug 11 '23 at 22:03
  • Yes, we do have many external IDPs. – roczstar Aug 14 '23 at 14:14

0 Answers0