コード例 #1
0
 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);
     // Add custom user claims here
     return userIdentity;
 }
コード例 #2
0
        public async Task <ClaimsIdentity> AuthenticateUserAsync(string userName, string password, string claimType)
        {
            var user = await userManager.FindAsync(userName, password);

            return(await userManager.CreateIdentityAsync(user, claimType));
        }