+ 8
Decrypting .net cookies
Is it possible to decrypt owin asp.net application cookies without using asp.net c# itself? How?
1 Antwort
+ 7
Here’s an example that simply displays all of the user’s claims from either an AccessToken or Cookie:
// Allow CORS for all origins.
[EnableCors(origins: "*", headers: "*", methods: "*")]
[HostAuthentication("Application")]
[Authorize]
public class UserController : ApiController
{
public object Get()
{
var identity = this.User.Identity as ClaimsIdentity;
var roleClaims = identity.Claims.Where(x => x.Type == ClaimsIdentity.DefaultRoleClaimType).Select(x => x.Value).ToList();
var nonRoleClaims = identity.Claims.Where(x => x.Type != ClaimsIdentity.DefaultRoleClaimType).Select(x => new { Type = x.Type, Value = x.Value }).ToList();
return new { name = identity.Name, roles = roleClaims, claims = nonRoleClaims };
}
}