Adldap\Laravel\Auth\DatabaseUserProvider::retrieveByCredentials PHP Method

retrieveByCredentials() public method

public retrieveByCredentials ( array $credentials )
$credentials array
    public function retrieveByCredentials(array $credentials)
    {
        $user = $this->retrieveLdapUserByCredentials($credentials);
        // We need to check if we have the right user instance, as well
        // as set the currently authenticated user in this case.
        if ($user instanceof User && ($this->user = $user)) {
            // We'll retrieve the login name from the LDAP user.
            $username = $this->getLoginUsernameFromUser($user);
            // Then, get their password from the given credentials.
            $password = $this->getPasswordFromCredentials($credentials);
            // Perform LDAP authentication.
            if ($this->authenticate($username, $password)) {
                // Passed, create / find the eloquent model from our Adldap user.
                $model = $this->getModelFromAdldap($user, $password);
                if (method_exists($model, 'trashed') && $model->trashed()) {
                    // If the model is soft-deleted, we'll fire an event
                    // with the affected LDAP user and their model.
                    $this->handleAuthenticatedModelTrashed($user, $model);
                    // We also won't allow soft-deleted users to authenticate.
                    return;
                }
                if ($this->getOnlyAllowImportedUsers() && !$model->exists) {
                    // If we're only allowing already imported users
                    // and the user doesn't exist, we won't
                    // allow them to authenticate.
                    return;
                }
                return $model;
            }
        }
        if ($this->getLoginFallback()) {
            // Login failed. If login fallback is enabled
            // we'll call the eloquent driver.
            return parent::retrieveByCredentials($credentials);
        }
    }