JWT, ClaimIdentity and ClaimPrincipal
Hi everyone,
I have a service that creates a JWT using the JsonWebTokenHandler. When I create my claims, I am using
I add these to create a ClaimsIdentity and set the authenticationType to a string, set nameType and roleType as per the above. I am now trying to handle the refresh token which requires me to get a ClaimsPrincipal. I validate the token using JsonWebTokenHandler and use the result to instantiate a ClaimsPrincipal using the token Claims. When I inspect the ClaimsPrincipal, the AuthenticationType is set to AuthenticationType.Federated and the two claims contain the long XML schema names. In my JWTBearer options, I have set MapInboundClaims to false.
If I simply use ClaimTypes.Name and ClaimTypes.Role, the claims end up in the token with the long schema names also instead of the short name even though MapInboundClaims is set to false.
Can someone explain how to get a ClaimsPrincipal using the correct authentication type and short claim names.
0 Replies