0

I store data before logging user in

  var identity = new ClaimsIdentity(CookieAuthenticationDefaults.AuthenticationScheme, ClaimTypes.Name, ClaimTypes.Role);
  identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, loginData.Username));
  identity.AddClaim(new Claim(ClaimTypes.Name, loginData.Username));
  identity.AddClaim(new Claim(ClaimTypes.Role, "Dev"));
  var principal = new ClaimsPrincipal(identity);
  await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, principal, new AuthenticationProperties { IsPersistent = loginData.RememberMe });

Now how can i print role or check?

   @Context.User.Claims.Select(c => c.Value)

this does not work

Jackal
  • 3,359
  • 4
  • 33
  • 78

0 Answers0