Perform the authentication of username and password through LDAP.

@return boolean TRUE when login has been successfull, else FALSE
@throws \AppserverIo\Psr\Security\Auth\Login\LoginException Is thrown if an error during login occured
480797
public function login()
    {

        // initialize the flag for the successfull login
        $this->loginOk = false;

        // array containing the username and password from the user's input
        list ($this->username, $password) = $this->getUsernameAndPassword();

        // query whether or not password AND username are set
        if ($this->username === null && $password === null) {
            $this->identity = $this->unauthenticatedIdentity;
        }

        // try to create a identity based on the given username
        if ($this->identity === null) {
            try {
                $this->identity = $this->createIdentity($this->username);
            } catch (\Exception $e) {
                throw new LoginException(
                    sprintf('Failed to create principal: %s', $e->getMessage())
                );
            }
        }

        // connect to the LDAP server
        $ldapConnection = $this->ldapConnect();

        // replace the placeholder  with the actual username of the user
        $this->baseFilter = preg_replace('/\{0\}/', "$this->username", $this->baseFilter);

        // try to load the user from the LDAP server
        $search = ldap_search($ldapConnection, $this->baseDN, $this->baseFilter);
        $entry = ldap_first_entry($ldapConnection, $search);
        $this->userDN = ldap_get_dn($ldapConnection, $entry);

        // query whether or not the user is available
        if (!isset($this->userDN)) {
            throw new LoginException('User not found in LDAP directory');
        }

        // bind the authenticating user to the LDAP directory
        if ((ldap_bind($ldapConnection, $this->userDN, $password)) === false) {
            throw new LoginException('Username or password wrong');
        }

        // query whether or not password stacking has been activated
        if ($this->getUseFirstPass()) {
            // add the username and password to the shared state map
            $this->sharedState->add(SharedStateKeys::LOGIN_NAME, $this->username);
            $this->sharedState->add(SharedStateKeys::LOGIN_PASSWORD, $this->credential);
        }

        // set the login flag to TRUE and return
        return $this->loginOk = true;
    }
977843
public function login()
    {
        if ($this->validate()) {
            return Podium::getInstance()->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0);
        }
        return false;
    }
940272
protected function login()
    {
        // Perform a request with the login credentials in the request header.
        $response = $this->client->get('services/login', [
            'headers' => ['username'=> $this->username, 'password' => $this->password],
        ]);

        // Parse the response body.
        $json = json_decode($response->getBody());
        $body = $json->{'nl.divide.iq'};
        $expire = new \DateTime($body->expiration_date, new \DateTimezone('UTC'));

        // Store the authentication token in the object.
        $this->authToken = new Token($body->authentication_token, $expire);

        return $this;
    }
1366444
public function authenticate()
	{
		if (!$this->checkError()) {
			return false;
		}

		try {
			$proxy = $this->getProxy();

			if (!empty($_GET['code'])) {
				// This was a callback request from a service, get the token
				$proxy->requestAccessToken($_GET['code']);
				$this->authenticated = true;
			} else if ($proxy->hasValidAccessToken()) {
				$this->authenticated = true;
			} else {
				/** @var $url Uri */
				$url = $proxy->getAuthorizationUri();
				Yii::$app->getResponse()->redirect($url->getAbsoluteUri())->send();
			}
		} catch (OAuthException $e) {
			throw new ErrorException($e->getMessage(), $e->getCode(), 1, $e->getFile(), $e->getLine(), $e);
		}

		return $this->getIsAuthenticated();
	}
354732
public function login()
    {

        //connect if not connected
        if(!$this->connected){

            $this->reconnect();
        }
        //calc the jid from uname+host
        $this->jid = $this->uname.'@'.substr($this->host, strpos($this->host, '//')+2);

        if($this->pass){

            $this->write("<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='PLAIN'>" . base64_encode("\x00" . $this->uname . "\x00" . $this->pass) . "</auth>");
        } else {
            $this->write("<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='ANONYMOUS' />");
    }

        $buffer = $this->read();
        if(substr($buffer, 0, 5) == '<fail'){
            $this->onError(0, 'Cound not log in');
            return false;

        }

        $this->client_name = empty($this->client_name) ? __CLASS__ : $this->client_name;

        if(!$this->sendClientName()){
            return false;
        }

        $this->setStatus($this->status);

        $this->onAfterLogin();

        return true;

    }
839063
protected function login()
    {
        return $this->query('login '.md5(substr($this->read(true), 17) . $this->pwd)) == 'Authentication successful, rcon ready.';
    }
812922
public static function httpAuthenticate() {
		try { 
			static::httpLogin();
			return true;
		} catch( NotFoundException $e ) {
			if( Config::get('httpauth_autocreate') ) {
				$user = static::httpCreate();
				$user->login();
				return true;
			}
		} catch( UserException $e ) { }
		return false;
	}
630088
public function isLoggedIn()
    {
        $response = $this->client->get($this->uri());

        try {
            $body = $this->handleResponse($response)->getDecodedData();
        } catch (ClientException $exception) {
            return false;
        }

        return property_exists(
            $body,
            'user'
        );
    }
499024
public static function authenticate() {
		$credentials = array(
			'calendar_guid' => (int) get_input('guid'),
			'user_guid' => (int) get_input('u'),
			'token' => get_input('t'),
		);

		$pam = new ElggPAM(self::POLICY);
		$authenticated = $pam->authenticate($credentials);
		if (!$authenticated) {
			throw new LoginException($pam->getFailureMessage());
		} else {
			$user = get_entity($credentials['user_guid']);
			login($user);
		}
		return $authenticated;
	}
997225
public function login()
    {
        $result = $this->adapter->getResult();
        if ($result === self::PHAVOUR_AUTH_SERVICE_SUCCESS) {
            $auth = Auth::getInstance();
            $auth->login($this->adapter->getIdentity());
            $auth->setRoles($this->adapter->getRoles());

            return true;

        } elseif ($result === self::PHAVOUR_AUTH_SERVICE_INVALID) {
            throw new InvalidCredentialsException('Invalid credentials exception');
        }

        throw new UnrecognisedAuthenticationResultException('Expected 1 or 2');
    }
129340
public function authenticate()
    {
        $object = 'login';
        $url = sprintf('/api/%s/version/%s', $object, $this->version);
        $parameters = array(
            'email'    => $this->email,
            'password' => $this->password,
            'user_key' => $this->userKey,
            'format'   => $this->format
        );

        $this->apiKey = $this->doPost($object, $url, $parameters);

        return $this->apiKey;
    }
1238942
public function connect()
	{
		if ($this->host == '')
		{
			return false;
		}

		if ($this->ignore_reqcert_tls)
		{
			putenv('LDAPTLS_REQCERT=never');
		}

		if ($this->ldap_debug)
		{
			ldap_set_option(null, LDAP_OPT_DEBUG_LEVEL, 7);
		}

		$this->resource = ldap_connect($this->host, $this->port);

		if (!$this->resource)
		{
			return false;
		}

		if ($this->use_ldapV3 && !ldap_set_option($this->resource, LDAP_OPT_PROTOCOL_VERSION, 3))
		{
			return false;
		}

		if (!ldap_set_option($this->resource, LDAP_OPT_REFERRALS, (int) $this->no_referrals))
		{
			return false;
		}

		if ($this->negotiate_tls && !ldap_start_tls($this->resource))
		{
			return false;
		}

		return true;
	}
865262
public function isLoggedIn()
    {
        $roleModel = new \erdiko\users\models\Role;
        $roleGeneral = $roleModel->findByName('user');

		// @todo update exception message for clarity
        if (empty($roleGeneral)){
            throw  new \Exception('Error, role user not found.');
        }

		return ( ( $this->_user->getId() > 0 ) && ( $this->_user->getRole() !== $roleGeneral->getId() ) );
	}
564169
public static function CheckAuthentication(){
            $oThis = self::CreateInstanceIfNotExists();
            $bReturn = ($oThis->bStarted) ? (!empty($oThis->aAuth["id"]) && !empty($oThis->aAuth["username"]) && ((intval($oThis->aAuth["timeout"]) > time()) || (intval($oThis->aAuth["timeout"]) <= 0))) : false;
            return $bReturn;
        }
906399
function authenticate() {
        switch ($this->_passwordAuthenticationPlatform) {
            case \USERCREDENTIAL_PASSWORDLOGINPLATFORM_NATIVE:
                return $this->authenticateNative();
            case \USERCREDENTIAL_PASSWORDLOGINPLATFORM_LDAP:
                return $this->authenticateLDAP();
            default:
                throw new UserCredentialException('Unknown native authentication platform requested');
        }
    }
810990
public function authenticate(): bool
	{
		try {
			$res = $this->request('account/verify_credentials', 'GET');
			return !empty($res->id);

		} catch (Exception $e) {
			if ($e->getCode() === 401) {
				return false;
			}
			throw $e;
		}
	}
1080855
public function isLoggedIn() : bool {

		// Requires a started session
		if (isset($_SESSION["login_token"])) {
			$loginToken = $_SESSION["login_token"];
			return $this->sessionManager->isValidLoginToken($loginToken);
		} else {
			return false;
		}
	}