Decrypting .net cookies | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula gr√°tis
+ 8

Decrypting .net cookies

Is it possible to decrypt owin asp.net application cookies without using asp.net c# itself? How?

11th Jul 2019, 12:49 PM
Sarthak Pokhrel
Sarthak Pokhrel - avatar
1 Resposta
+ 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 }; } }
12th Jul 2019, 4:48 AM
Prabhat
Prabhat - avatar