/**
  * Authenticates user on request.
  *
  * @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event
  *   The request event.
  *
  * @see \Drupal\Core\Authentication\AuthenticationProviderInterface::authenticate()
  */
 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);
             }
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Authenticates user on request.
  *
  * @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event
  *   The request event.
  *
  * @see \Drupal\Core\Authentication\AuthenticationProviderInterface::authenticate()
  */
 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());
     }
 }