public async Task <ActionResult <UserInfoAuthenticationResult> > ValidateCredentials(UserInfo userInfo) { try { var item = await _context.UserInfos.Where(x => x.Allow == IsActive.Y && x.UserId == userInfo.UserId).FirstOrDefaultAsync(); if (item == null) { return(NotFound()); } else { if (!_encryptionDecryption.VerifyHashedPassword(item.Pass, userInfo.Pass)) { return(new UserInfoAuthenticationResult() { Id = item.Id, UserId = item.UserId, IsAuthenticated = false, UserRole = item.UserRole, HashedData = HashUserDataForIdentityProtection(item, false) });; } } return(new UserInfoAuthenticationResult() { Id = item.Id, UserId = item.UserId, IsAuthenticated = true, UserRole = item.UserRole, HashedData = HashUserDataForIdentityProtection(item, true) }); } catch (Exception ex) { Log.ForContext <UserInfosController>().Error(ex.Message); return(BadRequest(ex.Message)); } }