Пример #1
0
        private AuthenticationStatus AuthenticateViaLdap(LoginInfo loginInfo, string password, AuthenticationTypes authenticationType = AuthenticationTypes.Secure)
        {
            try
            {
                _authenticator.Bind(loginInfo, password, authenticationType);

                return(AuthenticationStatus.Success);
            }
            catch (LdapException ldapException)
            {
                _log.LogError(LogSourceLdap, ldapException);
                if (ldapException.ErrorCode == LdapInvalidCredentialsErrorCode)
                {
                    return(AuthenticationStatus.InvalidCredentials);
                }

                return(AuthenticationStatus.Error);
            }
            catch (Exception ex)
            {
                _log.LogError(LogSourceLdap, ex);

                return(AuthenticationStatus.Error);
            }
        }