コード例 #1
0
        public Tuple <bool, string, string> Handle(LoginUser request)
        {
            var user = _userDirectoryReader.Where(ud => ud.Username.Equals(request.Username, StringComparison.InvariantCultureIgnoreCase)).SingleOrDefault();

            if (user != null && _passwordService.IsPasswordValid(request.Password, user.Password, out string updatedPasswordHash))
            {
                var encodedToken = _jwtService.EncodeToken(_tokenGenerator.CreateFromUserId(user.UserId));
                return(new Tuple <bool, string, string>(true, encodedToken, updatedPasswordHash));
            }

            return(new Tuple <bool, string, string>(false, String.Empty, String.Empty));
        }