@param array $credentials

@return SoapClientBuilder
@throws \InvalidArgumentException
550783
public function setAuthentication(array $credentials): AbstractClientBuilder
    {
        if (array_key_exists('session_id', $credentials)) {
            $this->authentication = new HeaderAuthenticate($credentials['session_id']);
        } elseif (array_key_exists('username', $credentials) && array_key_exists('password', $credentials)) {
            $this->authentication = new HeaderLogin($credentials['username'], $credentials['password']);
        } else {
            throw new \InvalidArgumentException('No credentials given.');
        }

        return $this;
    }
1014202
private function connect(Credentials $credentials) : PDO
    {
        if ($this->pdo === null) {
            $this->pdo = new PDO($credentials->getDSN(), $credentials->getUsername(), $credentials->getPassword());
        }

        return $this->pdo;
    }
242829
protected function doFindIdentityMatch(array $credentials)
    {
        ErrorStack::handleError(E_WARNING); // {
            $hFile = fopen($this->getPwdFilePath(), 'r');
        $error = ErrorStack::handleDone();  // }

        if ($hFile === false)
            throw new \RuntimeException("Cannot open '{$this->getPwdFilePath()}' for reading", 0, $error);


        $username = $this->getUsername();
        $password = $this->getPassword();
        if (!isset($username))
            throw new exMissingCredential('Adapter Credential not contains Username.');

        $realm = $this->getRealm();

        $id       = "$username:$realm";
        while (($line = fgets($hFile)) !== false) 
        {
            $line = trim($line);
            
            if (substr($line, 0, strlen($id)) !== $id)
                ## try next (user:realm) not match
                continue;

            if (!isset($password)) {
                // just username match, digest http authorization need secret key (A1)
                $identity = new IdentityHttpDigest;
                $identity->setUsername($username);
                $a1Hash = substr($line, strlen($id)+1 /* +1 for : */);
                if (strlen($a1Hash) !== 32) continue; // it seems invalid a1hash just continue; if match others.
                $identity->setA1(strtolower($a1Hash));

                return $identity;
            }

            if (isset($password)
                ## 32 for md5 length
                && strtolower(substr($line, -32)) === strtolower(md5("$username:$realm:$password"))
            ) {
                ## user/pass credential match
                $identity = new IdentityUsername;
                $identity->setUsername($username);

                return $identity;
            }
        }

        return false;
    }
956660
public function setupCredentials(array $credentials)
    {
        if (!array_key_exists('key', $credentials)) {
            throw new InvalidApplicationKeyException();
        }
        if (!array_key_exists('secret', $credentials)) {
            throw new InvalidApplicationSecretKeyException();
        }
        if (isset($credentials['redirect_uri'])) {
            $this->currentUri->setPath($credentials['redirect_uri']);
        }
        $this->credentials = new Credentials(
            $credentials['key'],
            $credentials['secret'],
            $this->getCurrentUri()
        );
    }
1100656
protected function validateReset(array $credentials)
    {
        if (is_null($user = $this->getUser($credentials))) {
            return static::INVALID_USER;
        }

        if (! $this->validateNewPassword($credentials)) {
            return static::INVALID_PASSWORD;
        }

        if (! $this->validateToken($user, $credentials)) {
            return static::INVALID_TOKEN;
        }

        if (! $this->validateTimestamp($credentials['expiration'])) {
            return static::EXPIRED_TOKEN;
        }

        return $user;
    }
444712
public function loadServicesConfig()
    {
        $configPath = $this->serviceConfigPath;

        if (!file_exists($configPath)) {
            throw new InvalidArgumentException(
                sprintf(
                    "Service config file '%s' doesn`t exists",
                    $configPath
                )
            );
        }

        $config = json_decode(file_get_contents($configPath), true);

        if (!is_array($config)) {
            throw new RuntimeException('Empty credentials config');
        }

        $this->serviceConfig = $config;

        return $this;
    }
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);
		}
	}
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,
        ));
    }
1010605
private function processAuthentication(array $credentials)
    {
        /** @var \Ma27\ApiKeyAuthenticationBundle\Service\Auth\AuthenticationHandlerInterface $authenticationHandler */
        $authenticationHandler = $this->get('ma27_api_key_authentication.auth_handler');
        /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher */
        $dispatcher = $this->get('event_dispatcher');

        try {
            $user = $authenticationHandler->authenticate($credentials);
        } catch (CredentialException $ex) {
            $userOrNull = $user ?? null;
            $dispatcher->dispatch(
                Ma27ApiKeyAuthenticationEvents::CREDENTIAL_EXCEPTION_THROWN,
                new OnCredentialExceptionThrownEvent($ex, $userOrNull)
            );

            return [$userOrNull, $ex];
        }

        return [$user, null];
    }
1184186
public function retrieveByCredentials(array $credentials)
    {

        if (empty($credentials)) {
            return null;
        }

        $query = $this->createModel()->newQuery();

        // Append the domain name to user's credentials if not set
        // stores the email in the DB for potential usage like notifications.
        if (false === strpos($credentials['email'], '@')) {
            $credentials['email'] .= '@' . $this->domain;
        }

        $query->where('email', $credentials['email']);

        $model = $query->first();

        if ($model) {
            return $model;
        }

        $model = $this->makeModel($credentials);

        return $model;
    }
1110813
public function setCredential($credential)
    {
        $credential = (string) $credential;
        if ($credential === '') {
            throw new \InvalidArgumentException('$credential cannot be empty');
        }

        $this->credential = $credential;

        return $this;
    }
628460
public function validateNewPassword(array $credentials)
    {
        if (isset($this->passwordValidator)) {
            [$password, $confirm] = [
                $credentials['password'],
                $credentials['password_confirmation'],
            ];

            return call_user_func(
                $this->passwordValidator, $credentials
            ) && $password === $confirm;
        }

        return $this->validatePasswordWithDefaults($credentials);
    }
427686
public function retrieveByCredentials(array $credentials)
	{
		if (Authorizer::validateAccessToken(false, $credentials[$this->token_key])) {
			$user_id = Authorizer::getResourceOwnerId();

			return $this->retrieveById($user_id);
		}

		return null;
	}
940011
public function retrieveByCredentials(array $credentials)
	{
		$result = ldap_search($this->conn, $this->config['basedn'], "(samaccountname={$credentials['username']})", $this->config['attributes']);
		if ($result === FALSE)
			return NULL;

		$entries = ldap_get_entries($this->conn, $result);
		if ($entries['count'] == 0 || $entries['count'] > 1)
			return NULL;

		return $this->clean($entries[0]);
	}
636100
public function validate(array $credentials = [])
    {
        $this->lastAttempted = $user = $this->provider->retrieveByCredentials($credentials);

        return $this->hasValidCredentials($user, $credentials);
    }
845852
public function getService($serviceClass, $clientCustomerId = null, $credentials = null)
    {
        $adwordsServices = new AdWordsServices();

        $session = $this->session($clientCustomerId, $credentials);

        return $adwordsServices->get($session, $serviceClass);
    }
1114831
public function read(array $credentials)
    {
        try {

            while (($job = $this->connect->peekReady()) !== false) {

                $message = unserialize($job->getBody());

                if($message['hash'] === $credentials['hash']) {
                    // hash found! Remove job from queue and return message
                    $job->delete();
                    unset($message['hash']);
                    return $message;
                }
            }
        }
        catch(\Exception $e) {
            throw new BeanstalkMapperException($e->getMessage());
        }
    }