JwtSecurityTokenHandler missing claim mapping for "name"
See original GitHub issueThe 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);
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
c# - JwtSecurityTokenHandler don't map OIDC claims to ...
I have a JWT token which contains OIDC (role) claims. I use the JwtSecurityTokenHandler to read and parse the token.
Read more >ASP.NET Core and JSON Web Tokens - where are my claims?
The JwtSecurityTokenHandler class takes a static copy of the mapping dcutionary declared by ClaimTypeMapping , as you can see here on GitHub.
Read more >JwtSecurityTokenHandler Class (System.IdentityModel. ...
Gets or sets the OutboundClaimTypeMap which is used when creating a JwtSecurityToken from Claim(s). The JSON claim 'name' value is set to Type...
Read more >Missing Claims in the ASP.NET Core 2 OpenID Connect ...
NET Core 2 has a different (aka breaking) behavior when it comes to mapping claims from an OIDC provider to the resulting ClaimsPrincipal....
Read more >net core web api - JWT claims missing in ClaimsIdentity
When I'm inspecting ClaimsPrincipal, I can see only one claim that was added during token creation (either Name or Sub). Rest of the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
👋
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 ofname
when using OpenIdOnTokenReceived
(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 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 ?