Last active
January 6, 2020 14:47
-
-
Save RGBKnights/2bd3a411c63766fdbdac3abd3b58071f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//nuget: System.IdentityModel.Tokens.Jwt | |
var handler = new System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler(); | |
var header = AuthenticationHeaderValue.Parse(req.Headers["Authorization"]); | |
var token = handler.ReadJwtToken(header.Parameter); | |
var identity = new ClaimsIdentity(token.Claims, header.Scheme); | |
req.HttpContext.User = new ClaimsPrincipal(identity); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment