我正在通过一些额外的属性来扩展用户身份。 我跟着这个here,但我一直停止从UserManager获取UserIdentity:
namespace App.Models
{
// Add profile data for application users by adding properties to the ApplicationUser class
public class ApplicationUser : IdentityUser
{
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
{
// Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
//var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
var userIdentity = await manager.CreateAsync()//-here is my problem, no CreateIdentityAcync method...
// Add custom user claims here
return userIdentity;
}
// Your Extended Properties
public long? OrganizationId { get; set; }
}
}
我的UserManager没有CreateIdentityAsync方法的原因是什么?有没有办法解决这个问题并向Identity添加属性(所以我可以设置该用户是admin并为他/她启用更多功能)?