コード例 #1
0
        public AuthenticationResponse IsUserAuthenticated(string username, string password)
        {
            AuthenticationResponse response;
            User user = _userRepository.Read(username);

            if (user == null)
            {
                response = AuthenticationResponse.InvalidLogin(LoginResponseType.InvalidUsername);
            }
            else if (!user.Password.Equals(password))
            {
                response = AuthenticationResponse.InvalidLogin(LoginResponseType.InvalidPassword);
            }
            else
            {
                response = AuthenticationResponse.SuccessfulLogin(user);
            }
            return(response);
        }