Created
February 19, 2020 11:58
-
-
Save kzelda/26d72c3dc2b9b0d07f3079b959cfd189 to your computer and use it in GitHub Desktop.
Decrypt Identity OAuth Bearer Token using C#
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
| public Dictionary<string,string> DecryptIdentityOAuthToken(string token) | |
| { | |
| var ticket = Startup.OAuthServerOptions.AccessTokenFormat.Unprotect(token); | |
| var claims = new Dictionary<string,string>(); | |
| if (ticket != null && ticket.Identity != null && ticket.Identity.IsAuthenticated) | |
| { | |
| foreach(var claim in ticket.Identity.Claims) | |
| { | |
| claims.Add(claim.Type, claim.Value); | |
| } | |
| } | |
| return claims; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment