You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 14, 2017. It is now read-only.
How can I access the roles using the MVC OWIN middleware (UseOpenIdConnectAuthentication)?
I can see them coming through in the claims so they are read out of the token properly but Im not sure how I get them to a point where they can be used in the
[Authorize("RoleName")]
attribute.
I suspect it has something to do with the JwtSecurityTokenHandler.InboundClaimTypeMap, but I have no experience with this.
Is there an example you can point me to? Everything else seems to be working fine.
The text was updated successfully, but these errors were encountered:
Well, I apologize for maybe posting prematurely. My suspicion was correct and a little trial and error and I figured it out. For anyone else looking to do this add this to your startup.auth
JwtSecurityTokenHandler.InboundClaimTypeMap = new Dictionary<string, string>
{
{"role", System.Security.Claims.ClaimTypes.Role}
};
How can I access the roles using the MVC OWIN middleware (UseOpenIdConnectAuthentication)?
I can see them coming through in the claims so they are read out of the token properly but Im not sure how I get them to a point where they can be used in the
attribute.
I suspect it has something to do with the JwtSecurityTokenHandler.InboundClaimTypeMap, but I have no experience with this.
Is there an example you can point me to? Everything else seems to be working fine.
The text was updated successfully, but these errors were encountered: