Ejemplo n.º 1
0
        public async Task <GetResponseModel> Authenticate(string UserName, string Password, int[] UserType)
        {
            GetResponseModel getResponseModel = new GetResponseModel();

            var userDetails = await _authenticateRepository.GetUserDetails(x => x.Username == UserName && UserType.Contains(x.UserType));

            if (userDetails == null && userDetails.Password != AuthenticateUtility.GeneratePassword(Password, userDetails.PasswordSalt))
            {
                getResponseModel.NoContent = true;
            }
            else
            {
                AuthenticateResponse authenticateResponse = new AuthenticateResponse()
                {
                    Token        = GenerateJwtToken(userDetails),
                    RefreshToken = GenerateRefreshToken("")
                };
                getResponseModel.Content = authenticateResponse;
            }
            getResponseModel.Success = true;
            return(getResponseModel);
        }