.NET Core add Claim after AzuerAD Authentication
问题 My application signs in via AzureAD, but now I need to get information from the DB and then store the Role as a Claim. So my question is: How can I store the Role as Claim after authentication ? This is what I tried: var user = User as ClaimsPrincipal; var identity = user.Identity as ClaimsIdentity; identity.AddClaim(new Claim(ClaimTypes.Role, "Admin")); But when I go to another controller, the claim does not exist anymore ? Thanks 回答1: You can achieve that during the authentication , in OIDC