Assign the passed Credentials object to the ProxmoxVE.

@param object $credentials A custom object holding credentials or a
Credentials object to assign.

@throws \ProxmoxVE\Exception\AuthenticationException If can not login.
176029
public function setCredentials($credentials)
    {
        if (!$credentials instanceof Credentials) {
            $credentials = new Credentials($credentials);
        }

        $this->credentials = $credentials;
        $this->authToken = $this->login();
    }
1249431
public function setApiCredentials($credentials)
    {
        // Setting Default PayPal Mode If not set
        $this->setApiEnvironment($credentials);

        // Set API configuration for the PayPal provider
        $this->setApiProviderConfiguration($credentials);

        // Set default currency.
        $this->setCurrency($credentials['currency']);

        // Set default billing type
        $this->setBillingType($credentials['billing_type']);

        // Set Http Client configuration.
        $this->setHttpClientConfiguration();
    }
1356712
public function authenticate(array $credentials): Identity
	{
		list($username, $password) = $credentials;

		$user = $this->orm->users->getByUsername($username);

		if (!$user) {
			throw new AuthenticationException('The username is incorrect.', self::IDENTITY_NOT_FOUND);
		} elseif (!Passwords::verify($password, $user->password)) {
			throw new AuthenticationException('The password is incorrect.', self::INVALID_CREDENTIAL);
		} elseif (!$user->active) {
			throw new AuthenticationException('Account is deactivated.', self::NOT_APPROVED);
		} elseif (Passwords::needsRehash($user->password)) {
			$user->setPassword($password);
			$this->orm->persistAndFlush($user);
		}

		return new Identity($user->id);
	}
600379
public function setAuthentication(Authentication $authentication)
    {
        $firstAuthentication = null === $this->authentication;

        $this->authentication = $authentication;

        if ($firstAuthentication && is_resource($this->resource)) {
            $this->authenticate();
        }
    }
113835
public function findByCredentials(array $credentials)
	{
		$model     = $this->createModel();
		$loginName = $model->getLoginName();

		if ( ! array_key_exists($loginName, $credentials))
		{
			throw new \InvalidArgumentException("Login attribute [$loginName] was not provided.");
		}

		$passwordName = $model->getPasswordName();

		$query              = $model;
		$hashableAttributes = $model->getHashableAttributes();
		$hashedCredentials  = array();

		// build query from given credentials
		foreach ($credentials as $credential => $value)
		{
			// Remove hashed attributes to check later as we need to check these
			// values after we retrieved them because of salts
			if (in_array($credential, $hashableAttributes))
			{
				$hashedCredentials = array_merge($hashedCredentials, array($credential => $value));
			}
			else
			{
				$query = $query->where($credential, '=', $value);
			}
		}
		$user = $query->find();

		if ( ! $user->loaded() )
		{
			throw new UserNotFoundException("A user was not found with the given credentials.");
		}

		// Now check the hashed credentials match ours
		foreach ($hashedCredentials as $credential => $value)
		{
			if ( ! $this->hasher->checkhash($value, $user->{$credential}))
			{
				$message = "A user was found to match all plain text credentials however hashed credential [$credential] did not match.";

				if ($credential == $passwordName)
				{
					throw new WrongPasswordException($message);
				}

				throw new UserNotFoundException($message);
			}
		}

		return $user;
	}
193223
private function setApiProvider($credentials)
    {
        if ($this instanceof \Srmklive\PayPal\Services\AdaptivePayments) {
            $this->setAdaptivePaymentsOptions();
        } elseif ($this instanceof \Srmklive\PayPal\Services\ExpressCheckout) {
            $this->setExpressCheckoutOptions($credentials);
        } else {
            throw new \Exception('Invalid api credentials provided for PayPal!. Please provide the right api credentials.');
        }
    }
359232
public function attempt(array $credentials)
    {
        if (! $this->auth->byCredentials($credentials)) {
            return false;
        }

        return $this->fromUser($this->user());
    }
195319
public function register(array $credentials, $activate)
    {
        try
        {
            if ( $this->validator->with($credentials)->passes() )
            {
                $this->users->register($credentials,$activate);
                return true;
            }
        }
        catch (LoginRequiredException $e)
        {
            $this->validator->add('LoginRequiredException',$e->getMessage());
        }
        catch (PasswordRequiredException $e)
        {
            $this->validator->add('PasswordRequiredException',$e->getMessage());
        }
        catch (UserExistsException $e)
        {
            $this->validator->add('UserExistsException',$e->getMessage());
        }

        return false;
    }
756295
protected function set_algorithm(string $algorithm):void{
		$algorithm = strtoupper($algorithm);

		if(!in_array($algorithm, ['SHA1', 'SHA256', 'SHA512'], true)){
			throw new AuthenticatorException('Invalid algorithm: '.$algorithm);
		}

		$this->algorithm = $algorithm;
	}
654619
public function authenticate(array $credentials)
	{
		[$username, $password] = $credentials;

		$ldap = $this->ldap->ldap_connect($this->server, $this->port);
		$this->ldap->ldap_set_option($ldap); //Set LDAP_OPT_PROTOCOL_VERSION (default 3)

		$res = ldap_bind($ldap, $this->user, $this->password);
		if (!$res) {
			throw new \Exception(self::ERROR_MESSAGE_LDAP_BIND);
		}

		$res = $this->ldap->ldap_search($ldap, $this->dn, $this->searchString($username));
		if ($this->ldap->ldap_count_entries($ldap, $res) !== 1) {
			throw new Nette\Security\AuthenticationException(self::ERROR_MESSAGE_AUTH_USER, self::IDENTITY_NOT_FOUND);
		}

		$entry = $this->ldap->ldap_first_entry($ldap, $res);
		$dn = $this->ldap->ldap_get_dn($ldap, $entry);

		//bind na prihlasovaneho uzivatele
		$res = $this->ldap->ldap_bind($ldap, $dn, $password);
		if (!$res) {
			throw new Nette\Security\AuthenticationException(self::ERROR_MESSAGE_AUTH_PASS, self::INVALID_CREDENTIAL);
		}
	}
896083
public function authenticate(string $password): void
    {
        $salt     = random_bytes(10);
        $keyBasis = $password.$salt;
        $key      = hash(Protocol::PASSWORD_HASH_TYPE, $keyBasis, true);
        $keyHash  = hash(Protocol::PASSWORD_HASH_TYPE, $key);
        $this->setHeader($this->getHeader()." ".strtoupper(Protocol::PASSWORD_HASH_TYPE.":$keyHash.".bin2hex($salt)));

    }
956503
public function setAccount($prefix, $username, $password) {
		$this->credentialsName = $this->computeCredentialsName($prefix);
		// Looking for existing credentials
		$credentials = array();
		if ($auth = $this->get('auth')) {
			foreach($this->configuration['auth'] as $k => $v) {
				$pos = strrpos($k, '.'); $attr = substr($k, $pos + 1); $pref = substr($k, 0, $pos);
				if (!array_key_exists($pref, $credentials)) $credentials[$pref] = array();
				$credentials[$pref][$attr] = $v;
			}
		}
		if (count($credentials)) {
			foreach($credentials as $k => $auth) {
				if (isset($auth['prefix']) && $auth['prefix'] == $prefix) {
					$this->credentialsName = $k;
					if (isset($auth['username']) || isset($auth['password'])) {
						if (	isset($auth['username']) && ($auth['username'] == $username || !strlen($username))
							&&	isset($auth['password']) && ($auth['password'] == $password || !strlen($username))
							)
						{
							// Same user/password
							return $this;
						}
						else {
							// user/password DO NOT match
						}
					}
					else {
						// user/password not defined
					}
					$PHPHg = array("{$this->credentialsName}.prefix" => $auth['prefix']);
					if (isset($auth['username'])) $PHPHg["{$this->credentialsName}.username"] = $auth['username'];
					if (isset($auth['password'])) $PHPHg["{$this->credentialsName}.password"] = $auth['password'];
					$this->set(array('PHPHg' => $PHPHg))->save();
					break;
				}
			}
		}
		else {
			// no credentials
			$this->set(array('PHPHg' => array()))->save();
		}

		$this->set(array('auth' => array(
			"{$this->credentialsName}.prefix" => $prefix,
			"{$this->credentialsName}.username" => $username,
			"{$this->credentialsName}.password" => $password,
		)))->save();
		
		return $this;
    }
83818
public function setProxy($proxy, $username = null, $password = null){
        $this->proxy = $proxy;
        if($username != null && $password != null){
            $this->proxyCredentials = $username . ":" . $password;
        }
    }
642387
public function login(array $credentials, $remember)
    {
        try
        {
            $this->users->authenticate($credentials,$remember);
            return true;
        }
        catch (LoginRequiredException $e)
        {
            $this->validator->add('LoginRequiredException', $e->getMessage());
        }
        catch (PasswordRequiredException $e)
        {
            $this->validator->add('PasswordRequiredException', $e->getMessage());
        }
        catch (WrongPasswordException $e)
        {
            $this->validator->add('WrongPasswordException', $e->getMessage());
        }
        catch (UserNotActivatedException $e)
        {
            $this->validator->add('UserNotActivatedException', $e->getMessage());
        }
        catch (UserNotFoundException $e)
        {
            $this->validator->add('UserNotFoundException', $e->getMessage());
        }
        catch (UserSuspendedException $e)
        {
            $this->validator->add('UserSuspendedException', $e->getMessage());
        }
        catch (UserBannedException $e)
        {
            $this->validator->add('UserBannedException', $e->getMessage());
        }

        return false;
    }
900276
public function authenticate(array $credentials)
    {
        list($username, $password) = $credentials;
        $user = $this->users->findOneBy(array('username' => $username));

        if (!$user) {
            throw new NS\AuthenticationException("User not found.", self::IDENTITY_NOT_FOUND);
        }

        if ($user->password !== $this->calculateHash($password)) {
            throw new NS\AuthenticationException("Invalid password.", self::INVALID_CREDENTIAL);
        }

        $permissions = array();
        foreach ($user->getRole()->getPermissions() as $key => $per) {
            $permissions[$per->getResource()] = $per->getRead();
        }

        return new NS\Identity($user->id, $user->getRole()->getName(), array(
            'username' => $user->username,
            'email' => $user->email,
            'permissions' => $permissions,
        ));
    }
1161534
protected function setCredentials($memcached, $credentials)
    {
        list($username, $password) = $credentials;

        $memcached->setOption(Memcached::OPT_BINARY_PROTOCOL, true);

        $memcached->setSaslAuthData($username, $password);
    }
81700
private function createNode(Credentials $credentials)
    {
        $host = $credentials->getHost();
        $port = $credentials->getPort();
        $connection = $this->connectionFactory->create($host, $port);

        return new Node($credentials, $connection);
    }