Authenticates against the supplied adapter

@return Result
@throws Exception\RuntimeException
763606
public function authenticate()
    {
        $allowOverride = $this->shardServiceManager->getAllowOverride();
        $this->shardServiceManager->setAllowOverride(true);

        $sysUser = new User;
        $sysUser->addRole('sys::authenticate');
        $this->shardServiceManager->setService('user', $sysUser);
        
        $this->doctrineAdapter->setIdentity($this->identity);
        $this->doctrineAdapter->setCredential($this->credential);
        $result = $this->doctrineAdapter->authenticate();
             
        if ($result->isValid()) {
            $this->shardServiceManager->setService('user', $result->getIdentity());
        } else {
            $sysUser->removeRole('sys::authenticate');
        }
        $this->shardServiceManager->setAllowOverride($allowOverride);
            
        return $result;
    }
1144111
public function getAuthenticationAdapter()
    {
        if (null === $this->authenticationAdapter) {
            $authenticationAdapter = $this->getAuthenticationService()->getAdapter();
            $this->setAuthenticationAdapter($authenticationAdapter);
        }

        return $this->authenticationAdapter;
    }
693162
public function getAdapter()
    {
        if (!$this->adapter) {
            throw new Exception\RuntimeException(sprintf(
                '"%s" unable to load adapter; adapter not found',
                __METHOD__
            ));
        }
        if (method_exists($this->adapter, 'setOptions')) {
            $this->adapter->setOptions($this->getAdapterOptions());
        }

        return $this->adapter;
    }
37200
protected function authenticate()
    {
        if (!$this->isAuthenticated) {
            list($url, $this->cdnUrl, $this->authToken) = $this->auth->authenticate();
            if ($this->useServicenet) {
                $url = str_replace('https://', 'https://snet-%s', $url);
            }

            $this->connectionUrlInfo = Utils::parseUrl($url);
            $this->httpConnect();

            if ($this->cdnUrl) {
                $this->cdnConnect();
            }

            $this->isAuthenticated = true;
        }
    }
390011
private function authenticate() {
        if (!is_resource($this->connection))
            throw new RuntimeException('Cannot authenticate: Not connected');

        // init authentication
        $this->writeData('AUTH LOGIN');
        $response = $this->readResponse();

        $this->parseResponse($response);
        if ($this->responseStatus == 503)
            return;                                     // already authenticated

        if ($this->responseStatus != 334)
            throw new RuntimeException('AUTH LOGIN command not supported: '.$this->responseStatus.' '.$this->response);

        // send username
        $this->writeData(base64_encode($this->options['auth_username']));
        $response = $this->readResponse();

        $this->parseResponse($response);
        if ($this->responseStatus != 334)
            throw new RuntimeException('Username '.$this->options['auth_username'].' not accepted'.$this->responseStatus.' '.$this->response);

        // send password
        $this->writeData(base64_encode($this->options['auth_password']));
        $response = $this->readResponse();

        $this->parseResponse($response);
        if ($this->responseStatus != 235)
            throw new RuntimeException('Login failed for username '.$this->options['auth_username'].': '.$this->responseStatus.' '.$this->response);
    }
536750
public function getUser()
    {
        if (null === $tokenStorage = $this->tokenStorage) {
            throw new \RuntimeException('The "app.user" variable is not available.');
        }

        if (!$token = $tokenStorage->getToken()) {
            return;
        }

        $user = $token->getUser();
        if (\is_object($user)) {
            return $user;
        }
    }
11981
public function authenticate()
    {
        if (static::AUTH_METHOD_NOT_SET === $this->options['authmethod']) {
            $this->detectAuthMethod();
        }

        switch ($this->options['authmethod']) {
            case static::AUTH_METHOD_NULL:
                $this->executeCommand('AUTHENTICATE');
                break;

            case static::AUTH_METHOD_HASHEDPASSWORD:
                $password = $this->getOption('password');
                if (false === $password) {
                    throw new \Exception('You must set a password option');
                }

                $this->executeCommand('AUTHENTICATE '.static::quote($password));
                break;

            case static::AUTH_METHOD_COOKIE:
                $cookieFile = $this->getOption('cookiefile');
                if (false === $cookieFile) {
                    throw new \Exception('You must set a cookiefile option');
                }
                $cookie = file_get_contents($cookieFile);

                $this->executeCommand('AUTHENTICATE '.bin2hex($cookie));
                break;
        }

        return $this;
    }
838770
private function authenticate()
    {
        $try = 0;

        while (true) {
            $try++;

            try {
                $response = $this->soapClient->__soapCall('GetAuthenticationToken', array(array(
                    'authenticationRequest' => $this->authenticationRequest->toArray(),
                )));

                return new AuthenticationTokenResponse(new \DateTime($response->GetAuthenticationTokenResult->DeprecatedDate), $response->GetAuthenticationTokenResult->Key);
            } catch (\SoapFault $e) {
                if (null !== $this->logger) {
                    $this->logger->critical(sprintf('[%] %s', __CLASS__, $e->getMessage()));
                }

                if ($try >= $this->retries) {
                    throw $e;
                }

                // waiting 500ms before next call
                usleep(500000);
            }
        }
    }
774590
public function authenticate( AdapterInterface $adapter = null )
    {
        $result = parent::authenticate( $adapter );

        if ( $result->isValid() )
        {
            $this->identityRefreshed = true;
        }

        return $result;
    }
531269
public function getAuthenticatedUser ()
    {
        $curUserEntity = $this->ServiceContainer->get('security.context')->getToken()->getUser();
        if (!is_object($curUserEntity)) {
            throw new Exception("No authenticated user found");
        }

        $CurUser = $this->getModelRepository('User')->getById($curUserEntity->getId());
        return $CurUser;
    }
423874
public function authenticate() {
		$this->authenticated = $this->auth->authenticate();
		$error = $this->auth->getError();
		if (isset($error)) {
			throw new EAuthException($error);
		}

		// In case of successful authentication save access token and
		// customer to session.
		if ($this->authenticated) {
			$this->saveCredentials();
		}

		return $this->getIsAuthenticated();
	}
572619
public function authenticate() {

        if ($this->hasOption(self::OPTION_PATTERN)) {
            if (preg_match($this->getOption(self::OPTION_PATTERN), $this->username) === 0) {
                throw new core_kernel_users_InvalidLoginException("Invalid pattern for user '" . $this->username . "'.");
            }
        }

    	$userClass = new core_kernel_classes_Class(GenerisRdf::CLASS_GENERIS_USER);
    	$filters = array(GenerisRdf::PROPERTY_USER_LOGIN => $this->username);
    	$options = array('like' => false, 'recursive' => true);
    	$users = $userClass->searchInstances($filters, $options);
    	
    	
    	if (count($users) > 1){
    		// Multiple users matching
    		throw new common_exception_InconsistentData("Multiple Users found with the same login '".$this->username."'.");
    	}
        if (empty($users)){
            // fake code execution to prevent timing attacks
            $label = new core_kernel_classes_Property(OntologyRdfs::RDFS_LABEL);
            $hash = $label->getUniquePropertyValue($label);
            if (!core_kernel_users_Service::getPasswordHash()->verify($this->password, $hash)) {
                throw new core_kernel_users_InvalidLoginException('Unknown user "'.$this->username.'"');
            }
            // should never happen, added for integrity
    		throw new core_kernel_users_InvalidLoginException('Inexisting user did not fail password check, this should not happen');
    	}
    	
	    $userResource = current($users);
	    $hash = $userResource->getUniquePropertyValue(new core_kernel_classes_Property(GenerisRdf::PROPERTY_USER_PASSWORD));
	    if (!core_kernel_users_Service::getPasswordHash()->verify($this->password, $hash)) {
	        throw new core_kernel_users_InvalidLoginException('Invalid password for user "'.$this->username.'"');
	    }

	    if ($this->hasOption(self::OPTION_USERFACTORY)){
            $userFactory = ServiceManager::getServiceManager()->get($this->getOption(self::OPTION_USERFACTORY)) ;

            if ($userFactory instanceof UserFactoryServiceInterface) {
                return $userFactory->createUser($userResource, UserHashForEncryption::hash($this->password));
            }
        }

        return (new UserFactoryService())->createUser($userResource);
    }
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;
	}
222438
protected function getAdapter()
    {
        $type = strtolower($this->options['type']);
        if (!$this->adapter) {
            if ($this->options['class']) {
                $adapterClass = $this->options['class'];
            } else {
                $adapterClass = '\\Wslim\\Security\\Crypt\\' . ucfirst($type) . 'Adapter';
            }
            
            if (!class_exists($adapterClass)) {
                throw new Exception('crypt type is not exists: ' . $type . ' .');
            }
            $this->adapter = new $adapterClass();
        }
        return $this->adapter;
    }
159356
private function authenticate()
    {
        $form = new RemoteIdentityForm;
        $form->attributes = array(
            'adapter'  => $this->getUserProfile(),
            'provider' => $this->getProvider()
        );

        return $form->login();
    }
377451
protected function authenticate()
    {
        $headers = [
            'Accept: application/json',
            'Content-Type: application/json; charset=utf-8',
        ];

        if (!empty($this->secret_token)) {
            $headers[] = 'X-AppSecretToken:'.$this->secret_token;
        }

        if (!empty($this->grant_token)) {
            $headers[] = 'X-AgreementGrantToken:'.$this->grant_token;
        }

        //default headers
        $options = [
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_SSL_VERIFYPEER => true,
            CURLOPT_HTTPAUTH       => CURLAUTH_BASIC,
            CURLOPT_HTTPHEADER     => $headers,
        ];

        curl_setopt_array($this->ch, $options);
    }
752856
public function authenticate()
    {
     Logger::get()->debug('Authenticating OpenID user...');
        if (!$this->isAuthenticated) {
            if (!static::getConsumer()->validate()) {
             Logger::get()->debug('  Failed!');
                throw new NotAuthenticatedException('OpenID authentication failed.');
            } else {
                $this->isAuthenticated = true;
            }
        }

     Logger::get()->debug('  OK!');
    }