Skip to content

No Name Claim & Duplicate Email Claims #18

Description

@ConnorJohnMacaskill

I have a very simple Azure web app configured to use Azure EasyAuth and have implemented this library with success. But I am having issues accessing certain fields in the HttpContext.User.Identity object.

The claims are set as expected, but the Name field is blank despite the "X-MS-CLIENT-PRINCIPAL" header containing a name claim. Manually decoding the header reveals it includes the following two lines:

"name_typ":"http:\/\/schemas.xmlsoap.org\/ws\/2005\/05\/identity\/claims\/emailaddress"
"role_typ":"http:\/\/schemas.microsoft.com\/ws\/2008\/06\/identity\/claims\/role

Which, due to this section of code in StandardPrincipleClaimMapper.cs, results in the name claim being retype as an emailaddress claim.

else if (claimsModel.Type.Equals(KnownEasyAuthClaimAliases.Name, StringComparison.OrdinalIgnoreCase))
{
    claimType = string.IsNullOrEmpty(headerPrincipalModel.NameClaimType) ? ClaimTypes.Name : headerPrincipalModel.NameClaimType;
}

This results in the identity being created with two emailaddress claims with different values, one containing my name and one containing my actual email address. The values of RoleClaimType and NameClaimType are also never passed as the "nameType" and "roleType" parameters when constructing the ClaimsIdentity object, resulting in the blank Name field.

Is there something I have configured incorrectly or is this intended behaviour? I can't seem to find anything relating to this online.

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions