public override async Task <IList <string> > GetRolesAsync(string userId) { using (var dc = new IdemContext()) { var userRoles = await(from d in dc.aspnet_Users where d.UserId.ToString().Equals(userId, System.StringComparison.OrdinalIgnoreCase) select d.aspnet_Roles).SingleOrDefaultAsync(); return(userRoles.Select(c => c.RoleName).ToList()); } }
public override async Task <aspnet_Membership> FindByNameAsync(string userName) { using (var dc = new IdemContext()) { var user = await(from d in dc.aspnet_Membership where d.aspnet_Users.UserName.Equals(userName, System.StringComparison.OrdinalIgnoreCase) select d).SingleOrDefaultAsync(); return(user); } }
public override async Task <aspnet_Membership> FindAsync(string userName, string password) { using (var dc = new IdemContext()) { var user = await FindByNameAsync(userName); if (user != null) { if (PasswordHasher.VerifyHashedPassword($"{user.Password}|{user.PasswordFormat}|{user.PasswordSalt}", password) == PasswordVerificationResult.SuccessRehashNeeded) { return(user); } } return(null); } }
public IdemService() { _context = new IdemContext(); }