Validate credentials of the specified <strategy> for the current user.

@param $strategy
@param $credentials
@param array $options
@return mixed
509981
public function validateMyCredentials($strategy, $credentials, array $options = [])
    {
        $options['httpParams'][':strategy'] = $strategy;

        return $this->query($this->buildQueryArgs('auth', 'validateMyCredentials'), ['body' => $credentials], $options)['result'];
    }
386232
public function retrieveByCredentials(array $credentials)
    {
        $criteria = [];
        foreach ($credentials as $key => $value) {
            if (!str_contains($key, 'password')) {
                $criteria[$key] = $value;
            }
        }

        return $this->getRepository()->findOneBy($criteria);
    }
4091
public function strategy(string $strategy, array $options = []): ListFilter
    {
        $this->main['strategy'] = $strategy;

        if (count($options)) {
            $this->main['options'] = $options;
        }

        return $this;
    }
947808
public function retrieveByCredentials(array $credentials)
    {
        $criteria = [];
        foreach ($credentials as $key => $value) {
            if (!Str::contains($key, 'password')) {
                $criteria[$key] = $value;
            }
        }

        return $this->getRepository()->findOneBy($criteria);
    }
563230
function Strategy(options, verify) {

  if (typeof options != 'object') options = {};

  if (!options.secretOrPublicKey) throw new TypeError(
    'JwtCookieComboStrategy requires a secret or public key'
  );

  if (!verify) throw new TypeError(
    'JwtCookieComboStrategy requires a verify callback'
  );

  passport.Strategy.call(this);

  this.name = 'jwt-cookiecombo';
  this._verify = verify;

  this._jwtVerifyOptions = Object.assign({}, options.jwtVerifyOptions);
  this._passReqToCallback = options.passReqToCallback || false;
  this._jwtHeaderKey = options.jwtHeaderKey || 'authorization';
  this._jwtCookieName = options.jwtCookieName || 'jwt';
  this._jwtCookieSecure = options.jwtCookieSecure !== false;
  this._secretOrPublicKey = options.secretOrPublicKey;

  this._jwtHeaderKey = this._jwtHeaderKey.toLowerCase();

}
952224
function Strategy(options, verify) {

  if (typeof options == 'function') {
    verify = options;
    options = {};
  }
  if (!verify) {
    throw new Error('cas authentication strategy requires a verify function');
  }

  this.ssoBase = options.ssoBaseURL;
  this.serverBaseURL = options.serverBaseURL;
  this.parsed = url.parse(this.ssoBase);
  if (this.parsed.protocol === 'http:') {
    this.client = http;
  } else {
    this.client = https;
  }

  passport.Strategy.call(this);

  this.name = 'cas';
  this._verify = verify;
}
72414
protected function getLoginCredential($credentials = array())
	{
		$loginField = $this->app['config']['auth.credentials.login'];

		if (isset($credentials[$loginField]))
		{
			return $credentials[$loginField];
		}
		else if (Input::has($loginField))
		{
			return Input::get($loginField);
		}
		else if (isset($credentials['user_login']))
		{
			return $credentials['user_login'];
		}
		else if (isset($credentials['log']))
		{
			return $credentials['log'];
		}

		throw new InvalidArgumentException("Login field not found");

	}
619377
public function createMyCredentials($strategy, $credentials, array $options = [])
    {
        $options['httpParams'][':strategy'] = $strategy;

        return $this->query($this->buildQueryArgs('auth', 'createMyCredentials'), ['body' => $credentials], $options)['result'];
    }
991422
protected function validateUser(array $credentials, $id = null)
    {
        $instance = $this->createModel();

        $loginNames = $instance->getLoginNames();

        // We will simply parse credentials which checks logins and passwords
        list($logins, $password, $credentials) = $this->parseCredentials($credentials, $loginNames);

        if ($id === null) {
            if (empty($logins)) {
                throw new InvalidArgumentException('No [login] credential was passed.');
            }

            if (empty($password)) {
                throw new InvalidArgumentException('You have not passed a [password].');
            }
        }

        return true;
    }
999955
public function verify(array $credentials, Closure $callback)
    {
        // If the responses from the validate method is not a user instance, we will
        // assume that it is a redirect and simply return it from this method and
        // the user is properly redirected having an error message on the post.
        $user = $this->validateEmailVerification($credentials);

        if (! $user instanceof CanVerifyEmailContract) {
            return $user;
        }

        if($callback($user)) {

            $this->events->dispatch(new UserVerified($user));

        }

        return static::VERIFIED;
    }
175890
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->newQuery();
		$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);
			}
		}

		if ( ! $user = $query->first())
		{
			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);
			}
			else if ($credential == $passwordName)
			{
				if (method_exists($this->hasher, 'needsRehashed') && 
					$this->hasher->needsRehashed($user->{$credential}))
				{
					// The algorithm used to create the hash is outdated and insecure.
					// Rehash the password and save.
					$user->{$credential} = $value;
					$user->save();
				}
			}
		}

		return $user;
	}
86450
public function seeCredentials(array $credentials, $guard = null)
    {
        $this->assertTrue(
            $this->hasCredentials($credentials, $guard), 'The given credentials are invalid.'
        );

        return $this;
    }
853441
public function login($strategy, Request $request)
    {
        $strategy = $this->get($strategy);
        $user = $strategy->convert($strategy->attempt($request));

        return $user;
    }
181056
public function setCredentials(array $credentials) : AuthenticatorInterface
    {
        if (array_key_exists('source', $credentials) && preg_match('/^api*/', $credentials['source'])) {
            $this->api = true;
            $this->source = $credentials['source'];
        }

        return $this;
    }
233564
public function checkUserCredentials($credential, $password)
    {
        $user = $this->getUserDataMapper()->findByCredential($credential);

        $userClass = $this->userClass;

        if (! $user instanceof $userClass) {
            return false;
        }

        foreach ($this->userCredentialsStrategies as $strategy) {
            $result = $strategy instanceof UserCredentialsStrategyInterface
                ? $strategy->isValid($user, $password)
                : call_user_func($strategy, $user, $password);

            if (! $result) {
                break;
            }
        }

        return isset($result) ? $result : false;
    }
1350160
private function validateLDAPCredentials(array $credentials)
    {
        $credentialsValidated = false;
        $adldap = false;

        try {

            $userPassword = $credentials['password'];
            $userName     = $credentials['username'];
            $ldapConOp    = $this->GetLDAPConnectionOptions();

            if (Settings::get('eloquent-ldap.debug')) {
                // Set LDAP debug log level - useful in DEV, dangerous in PROD!!
                ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
            }

            // Try to authenticate using AD/LDAP
            // Connect to AD/LDAP
            $adldap = new Adldap();
            $adldap->addProvider($ldapConOp);
            $provider = $adldap->connect();

            // For LDAP servers, the authentication is done with the full DN,
            // Not the username with the suffix as is done for MSAD servers.
            if ('LDAP' === Settings::get('eloquent-ldap.server_type')) {
                $ldapUser = $this->getLDAPUser($userName);
                $userName = $this->GetArrayValueOrDefault($ldapUser, 'dn', '');
            }

            $authUser = $provider->auth()->attempt($userName, $userPassword);
            // If the user got authenticated
            if ($authUser == true) {
                $credentialsValidated = true;
            } else {
                $this->handleLDAPError($adldap);
                $credentialsValidated = false;
            }
        } catch (\Exception $ex) {
            Log::error('Exception validating LDAP credential for user: ' . $userName . ', Exception message: ' . $ex->getMessage());
            Log::error($ex->getTraceAsString());
            $this->handleLDAPError($adldap);
            $credentialsValidated = false;
        }

        // Close connection.
        if (isset($provider)) {
            unset($provider);
        }
        // Close connection.
        if (isset($adldap)) {
            unset($adldap);
        }

        return $credentialsValidated;
    }
731223
public function whereConditions($strategy)
    {
        $instance = $this->whereStrategyInstance();

        $instance->whereStrategy()->whereConditions($strategy);

        return $instance;
    }