Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. AuthenticationSubscriber.php

function AuthenticationSubscriber::onKernelRequestAuthenticate

Authenticates user on request.

Parameters

\Symfony\Component\HttpKernel\Event\RequestEvent $event: The request event.

See also

\Drupal\Core\Authentication\AuthenticationProviderInterface::authenticate()

File

core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php, line 73

Class

AuthenticationSubscriber
Authentication subscriber.

Namespace

Drupal\Core\EventSubscriber

Code

public function onKernelRequestAuthenticate(RequestEvent $event) {
    if ($event->isMainRequest()) {
        $request = $event->getRequest();
        if ($this->authenticationProvider
            ->applies($request)) {
            $account = $this->authenticationProvider
                ->authenticate($request);
            if ($account) {
                $this->accountProxy
                    ->setAccount($account);
                return;
            }
        }
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal