Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

C# .net JwtSecurityTokenHandler jwttoken claims to object

You should be able to retrieve a claims like this within your controller

var identity = HttpContext.User.Identity as ClaimsIdentity;
if (identity != null)
{
    IEnumerable<Claim> claims = identity.Claims; 
    // or
    identity.FindFirst("ClaimName").Value;

}
If you wanted, you could write extension methods for the IPrincipal interface and retrieve claims using the code above, then retrieve them using (for example)

HttpContext.User.Identity.MethodName();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #JwtSecurityTokenHandler #jwttoken #claims #object
ADD COMMENT
Topic
Name
9+6 =