Ejemplo n.º 1
0
        /// <summary>
        /// Force user to type identifier and password
        /// </summary>
        /// <returns></returns>
        protected async Task GetUserCredentials()
        {
            _logger.LogInfo("Forcing user to enter username and password");

            while (Validating)
            {
                PromptMessage("Enter username: "******"Enter password: "******"Service not available", true);
                    PromptMessage("Starting work in offline mode", true);
                    _session.SetMode(WorkMode.OFFLINE);
                    Validating = false;
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// To check the username and password on correctness.
 /// </summary>
 /// <param name="login">Login.</param>
 /// <param name="password">Password.</param>
 /// <param name="clientAddress">Remote network address.</param>
 /// <returns>Session ID.</returns>
 public virtual Guid ValidateCredentials(string login, SecureString password, IPAddress clientAddress)
 {
     try
     {
         _client.Login(_product, _version, login, password);
         return(Guid.NewGuid());
     }
     catch (Exception ex)
     {
         throw new UnauthorizedAccessException(LocalizedStrings.WrongLoginOrPassword, ex);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// To check the username and password on correctness.
 /// </summary>
 /// <param name="login">Login.</param>
 /// <param name="password">Password.</param>
 /// <param name="clientAddress">Remote network address.</param>
 /// <returns>Session ID.</returns>
 public virtual Guid ValidateCredentials(string login, SecureString password, IPAddress clientAddress)
 {
     try
     {
         var sessionId = _client.Login(_product, _version, login, password).Item1;
         _sessionIds[login] = sessionId;
         return(sessionId);
     }
     catch (Exception ex)
     {
         throw new UnauthorizedAccessException(LocalizedStrings.WrongLoginOrPassword, ex);
     }
 }
Ejemplo n.º 4
0
        public bool AuthenticateUser(string emailAddress, string password)
        {
            var profile = _authenticationClient.Login(emailAddress, password);

            var loginWasUnsuccessful = profile == null || profile.Result.Success == false;

            if (loginWasUnsuccessful)
            {
                if (profile != null && profile.Result != null && !string.IsNullOrEmpty(profile.Result.ErrorMessage))
                {
                    _loggerService.LogInfo(profile.Result.ErrorMessage);
                }

                return(false);
            }

            SetUser(profile, true);

            return(true);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Implements <see cref="IUserService.LoginUser(LoginRequest)"/>
        /// </summary>
        public async Task <LoginResponse> LoginUser(LoginRequest loginRequest)
        {
            var response = await _authenticationClient.Login(loginRequest);

            return(response);
        }
Ejemplo n.º 6
0
        public async Task Login(UserLoginModel model)
        {
            await authenticationClient.Login(model);

            NotifyAuthenticationStateChanged(GetAuthenticationStateAsync());
        }