Answer the question
In order to leave comments, you need to log in
Get Microsoft Identity value/type?
I am using library ClaimsIdentity in Asp.net for user authentication.
var claims = new List<Claim>
{
new Claim(ClaimsIdentity.DefaultNameClaimType, loginModel.NickName),
new Claim(ClaimsIdentity.DefaultRoleClaimType, loginModel.UserRole),
new Claim("UserID", loginModel.UserId.ToString()),
};
ClaimsIdentity claimsIdentity = new ClaimsIdentity(
claims,
"ApplicationCookie",
ClaimsIdentity.DefaultNameClaimType,
ClaimsIdentity.DefaultRoleClaimType);
[Authorize(Roles = "administrator")]
public IActionResult Index() { //to do
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question