Validate a user against the given credentials.

@param  \Illuminate\Contracts\Auth\Authenticatable  $user
@param  array  $credentials
@return bool
175974
public function validateCredentials(UserContract $user, array $credentials)
    {
        $credentialsValidated = false;

        // If the user is set AND, either of auth_type 'internal' or with
        // auth_type unset or null, then validate against the stored
        // password hash. Otherwise if the LDAP authentication
        // method is enabled, try it.
        if ( isset($user) &&
             (
                ( isset($user->auth_type) && (Settings::get('eloquent-ldap.label_internal') === $user->auth_type) ) ||
                ( !isset($user->auth_type) )
             )
           ) {
            $plain = $credentials['password'];
            $credentialsValidated = $this->hasher->check($plain, $user->getAuthPassword());
        } else if ( (Settings::get('eloquent-ldap.enabled')) && (Settings::get('eloquent-ldap.label_ldap') === $user->auth_type) ) {
            // Validate credentials against LDAP/AD server.
            $credentialsValidated = $this->validateLDAPCredentials($credentials);
            // If validated and config set to resync group membership on login.
            if ( $credentialsValidated ) {
                // Sync user enable/disable state
                $this->syncEnable($user);
                if ( (Settings::get('eloquent-ldap.resync_on_login')) && (Settings::get('eloquent-ldap.replicate_group_membership'))) {
                    // First, revoke membership to all groups marked to 'resync_on_login'.
                    $this->revokeMembership($user);
                    // Then replicate group membership.
                    $this->replicateMembershipFromLDAP($user);
                }
            }
         }

        return $credentialsValidated;
    }
222962
public function validateCredentials(UserContract $user, array $credentials)
    {
        $plain = $credentials['user_pass'];

        return wp_authenticate($user->user_login, $plain);
    }
1167054
protected function verifyUser($user, $password)
    {
        if (!isset($this->userList[$user]))
        {
            return false;
        }
        if ($this->userList[$user] != $password)
        {
            return false;
        }
        return true;
    }
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;
    }
1312948
public function validate(array $credentials = array())
	{
		$username = $this->getLoginCredential($credentials);

		$password = $this->getPasswordCredential($credentials);

		$user = wp_authenticate_username_password(null, $username, $password);

		if (is_wp_error($user))
		{
			return false;
		}

		return true;
	}
960103
protected function validatePasswordWithDefaults(array $credentials)
    {
        [$password, $confirm] = [
            $credentials['password'],
            $credentials['password_confirmation'],
        ];

        return $password === $confirm && mb_strlen($password) >= 8;
    }
406948
public function create(array $credentials, $activate = false)
    {
        $user = $this->storeUser($credentials,$activate);
        $this->event->fire('users.create',array($user));

        return $user;
    }
75559
public function validateCredentials(Authenticatable $user, array $credentials)
    {
        //TODO determine if we even want to store the passowrd.
        if (! $this->authenticate($user, $credentials)) {

            $plain = $credentials['password'];

            return $this->hasher->check($plain, $user->getAuthPassword());
        }
        return true;
    }
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;
    }
251078
private function hasOpenEmailValidation(User $user)
    {
        $ts = $user->email_verification_token_timestamp;
        if (!empty($ts) && (time() - $this->module->emailVerificationTokenExpirationTime) <= $ts) {
            return true;
        }
        
        return false;
    }
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;
    }
1271575
public function validate( array $credentials = [] )
	{
		$credentials = [$this->storageKey => $credentials[$this->inputKey]];

		if ( $this->auth->retrieveByCredentials( $credentials ) )
			return true;

		return false;
	}
1074076
public function register(array $credentials, $activate = false)
	{
		$user = $this->userProvider->create($credentials);

		if ($activate)
		{
			$user->attemptActivation($user->getActivationCode());
		}

		return $this->user = $user;
	}
962614
public function getByCredentials(array $credentials) : ?Authenticatable
    {
        if (empty($credentials)) {
            return null;
        }

        // First we will add each credential element to the query as a where clause.
        // Then we can execute the query and, if we found a user, return it in a
        // Eloquent User "model" that will be utilized by the Guard instances.
        $query = $this->getModel()->newQuery();

        foreach ($credentials as $key => $value) {
            if (! Str::contains($key, 'password')) {
                $query->where($key, $value);
            }
        }

        return $query->first();
    }
1209325
public function verify(array $credentials, Closure $callback)
    {
        $user = $this->validateVerification($credentials);

        if (!$user instanceof Contracts\RequiresEmailVerification) {
            return $user;
        }

        call_user_func($callback, $user);

        $this->tokens->delete($credentials['token']);

        return Contracts\VerificationBroker::VERIFIED;
    }
409874
public function authenticate(array $credentials)
    {
        list($username, $password) = $credentials;

        $row = $this->database->table(self::TABLE_NAME)->where(self::COLUMN_NAME, $username)->fetch();

        if (!$row) {
            throw new Nette\Security\AuthenticationException('The username is incorrect.', self::IDENTITY_NOT_FOUND);

        } elseif (!Passwords::verify($password, $row[self::COLUMN_PASSWORD_HASH])) {
            throw new Nette\Security\AuthenticationException('The password is incorrect.', self::INVALID_CREDENTIAL);

        } elseif (Passwords::needsRehash($row[self::COLUMN_PASSWORD_HASH])) {
            $row->update([
                self::COLUMN_PASSWORD_HASH => Passwords::hash($password),
            ]);
        }

        $arr = $row->toArray();
        unset($arr[self::COLUMN_PASSWORD_HASH]);
        return new Nette\Security\Identity($row[self::COLUMN_ID], $row[self::COLUMN_ROLE], $arr);
    }
462773
public function isValid($username, $password, array $role = array())
    {
        foreach ($this->data as $user => $pass) {
            if ($user == $username && $pass == $password) {
                return true;
            }
        }

        return false;
    }