Identityserver4.admin: How to forward claims from Azure AD through IS4

Created on 13 Feb 2020  路  2Comments  路  Source: skoruba/IdentityServer4.Admin

When using IS4 combined with AzureAD, I would like that when a user logs in from a SPA client, he receives the AzureAD email address. Currently, there is an in-between screen that requires the user to insert an email address again. is there a way to map claims from azureAD to IS4?

requested scope: openid profile email

IS4 asking to fill in the email address:
image

IS4 configuration

if (externalProviderConfiguration.UseAzureAdProvider)
            {
                authenticationBuilder.AddOpenIdConnect("aad", "Login with Azure AD", options =>
                {
                    options.Authority = externalProviderConfiguration.AzureADAuthority;
                    options.ClientId = externalProviderConfiguration.AzureADClientId;
                    options.CallbackPath = "/signin-oidc";
                });
            }

Most helpful comment

Hello,

I do like this :

var email = info.Principal.FindFirstValue(ClaimTypes.Email) ??
                        info.Principal.FindFirstValue(ClaimTypes.Name);

return View("ExternalLoginConfirmation", new ExternalLoginConfirmationViewModel { Email = 
        email });

All 2 comments

Hello,

I do like this :

var email = info.Principal.FindFirstValue(ClaimTypes.Email) ??
                        info.Principal.FindFirstValue(ClaimTypes.Name);

return View("ExternalLoginConfirmation", new ExternalLoginConfirmationViewModel { Email = 
        email });

Thanks @tomadj 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ekjuanrejon picture ekjuanrejon  路  4Comments

denisisack picture denisisack  路  4Comments

knepe picture knepe  路  4Comments

imabdul-dev picture imabdul-dev  路  4Comments

saeedrahimi picture saeedrahimi  路  3Comments