コード例 #1
0
        //authenticate a user with username and password
        public async Task <UserDTO> AuthenticateUserAsync(string username, string password)
        {
            try
            {
                User authenticatedUserEntity = await UserDataLayerLogic.AuthenticateUserAsync(username, password);

                UserDTO createduserDTO = _mapper.Map <UserDTO>(authenticatedUserEntity);
                createduserDTO.Token    = GenerateToken(createduserDTO.UserId);
                createduserDTO.Password = null;
                return(createduserDTO);
            }

            catch (Exception ex)
            {
                throw ex;
            }
        }