Adldap\Laravel\Middleware\WindowsAuthenticate::retrieveAuthenticatedUser PHP Method

retrieveAuthenticatedUser() protected method

Returns the authenticatable user instance.
protected retrieveAuthenticatedUser ( string $key, string $username ) : Illuminate\Contracts\Auth\Authenticatable | null
$key string
$username string
return Illuminate\Contracts\Auth\Authenticatable | null
    protected function retrieveAuthenticatedUser($key, $username)
    {
        $provider = $this->auth->getProvider();
        try {
            // Find the user in AD.
            $user = $this->newAdldapUserQuery()->where([$key => $username])->firstOrFail();
            if ($provider instanceof NoDatabaseUserProvider) {
                $this->handleAuthenticatedUser($user);
                return $user;
            } elseif ($provider instanceof DatabaseUserProvider) {
                // Retrieve the Eloquent user model from our AD user instance.
                // We'll assign the user a random password since we don't
                // have access to it through SSO auth.
                $model = $this->getModelFromAdldap($user, str_random());
                // Save model in case of changes.
                $model->save();
                $this->handleAuthenticatedUser($user, $model);
                return $model;
            }
        } catch (ModelNotFoundException $e) {
            //
        }
    }