Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JwtSecurityTokenHandler missing claim mapping for "name" #1544

Closed
thomaslevesque opened this issue Oct 23, 2020 · 5 comments · Fixed by #1545
Closed

JwtSecurityTokenHandler missing claim mapping for "name" #1544

thomaslevesque opened this issue Oct 23, 2020 · 5 comments · Fixed by #1545
Labels
Customer reported Indicates issue was opened by customer Investigate We are not quite sure what the issue is.
Milestone

Comments

@thomaslevesque
Copy link
Contributor

thomaslevesque commented Oct 23, 2020

The name claim is a registered JWT claim for the user's full name (https://www.iana.org/assignments/jwt/jwt.xhtml)
However, it isn't included in the default mappings, unlike given_name and family_name.
It should probably be mapped to ClaimTypes.Name. Is there a reason for this, or is this just an oversight?

Workaround: execute this when the app starts:

JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Add("name", ClaimTypes.Name);
@brentschmaltz
Copy link
Member

@thomaslevesque claim mapping is an interesting subject, most of the feedback we have received is that we should not map any claims.
How do you use claim mapping?

@brentschmaltz brentschmaltz added Customer reported Indicates issue was opened by customer Investigate We are not quite sure what the issue is. labels Oct 26, 2020
@brentschmaltz brentschmaltz added this to the v6 Backlog milestone Oct 26, 2020
@thomaslevesque
Copy link
Contributor Author

@brentschmaltz, actually, I agree with the idea that no mapping at all would be better. But if there's a mapping, it might as well be done right. I know I could disable the mapping completely, but since it's done by default and everybody is used to it, I usually don't bother.

@AlexandreArpin
Copy link

👋

Just upgraded from 6.8 to 6.9 (AspNet Core 3.1) and experienced a breaking change.

I'm not super well versed in all things OpenId/Authentication/etc, but one of the side effect of this change was that now for some reason the "name" claim was now being mapped as http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name instead of name when using OpenId OnTokenReceived (We use OpenIdConnect, ADAL, Azure AD V1 Application and Work Account login).

We updated our mapping/claims logic to work on both versions, but we were rather lucky to have caught it (it's an Api surface that's rather difficult to unit test).

@brentschmaltz
Copy link
Member

brentschmaltz commented Apr 13, 2021

@AlexandreArpin we will have to roll this back, in the meantime, there is a workaround.
You can remove the entry from ClaimTypeMapping here:

public static IDictionary<string, string> DefaultInboundClaimTypeMap = ClaimTypeMapping.InboundClaimTypeMap;

@udlose
Copy link

udlose commented Apr 15, 2021

@AlexandreArpin we will have to roll this back, in the meantime, there is a workaround.

@brentschmaltz so is this going to be changed again in the future or do you mean, we shouldn't have done that and it will remain as it was in v6.8.0 before #1545 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Customer reported Indicates issue was opened by customer Investigate We are not quite sure what the issue is.
Projects
None yet
4 participants