AuthenticationSubscriber::onKernelRequestAuthenticate

public AuthenticationSubscriber::onKernelRequestAuthenticate(GetResponseEvent $event)

Authenticates user on request.

Parameters

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

See also

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

File

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

Class

AuthenticationSubscriber
Authentication subscriber.

Namespace

Drupal\Core\EventSubscriber

Code

public function onKernelRequestAuthenticate(GetResponseEvent $event) {
  if ($event->getRequestType() === HttpKernelInterface::MASTER_REQUEST) {
    $request = $event->getRequest();
    if ($this->authenticationProvider->applies($request)) {
      $account = $this->authenticationProvider->authenticate($request);
      if ($account) {
        $this->accountProxy->setAccount($account);
        return;
      }
    }
    // No account has been set explicitly, initialize the timezone here.
    date_default_timezone_set(drupal_get_user_timezone());
  }
}
doc_Drupal
2016-10-29 08:45:16
Comments
Leave a Comment

Please login to continue.