📅  最后修改于: 2022-03-11 15:00:53.796000             🧑  作者: Mango
public class ApplicationUser : IdentityUser
{
public string Name { get; set; }
public async Task GenerateUserIdentityAsync(UserManager manager)
{
// Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
// Add custom user claims here
userIdentity.AddClaim(new Claim("CustomName", Name));
return userIdentity;
}
}