public async Task <ClaimsIdentity> GenerateUserIdentityAsync(PhonebookUserManager manager, string authenticationType) { // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType var userIdentity = await manager.CreateIdentityAsync(this, authenticationType); // Add custom user claims here return(userIdentity); }
public static async Task <string> CreateAdminUser(PhonebookManagerContext context) { const string emailAddress = "*****@*****.**"; const string password = "******"; var phonebookUserManager = new PhonebookUserManager(new UserStore <User>(context)); var user = await phonebookUserManager.FindByEmailAsync(emailAddress); if (user == null) { user = new User { Email = emailAddress, UserName = emailAddress, }; await phonebookUserManager.CreateAsync(user, password); } return(string.Empty); }