You are here

public function AuthenticationSubscriber::onKernelRequestFilterProvider in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php \Drupal\Core\EventSubscriber\AuthenticationSubscriber::onKernelRequestFilterProvider()

Denies access if authentication provider is not allowed on this route.

Parameters

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

File

core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php, line 97
Contains \Drupal\Core\EventSubscriber\AuthenticationSubscriber.

Class

AuthenticationSubscriber
Authentication subscriber.

Namespace

Drupal\Core\EventSubscriber

Code

public function onKernelRequestFilterProvider(GetResponseEvent $event) {
  if (isset($this->filter) && $event
    ->getRequestType() === HttpKernelInterface::MASTER_REQUEST) {
    $request = $event
      ->getRequest();
    if ($this->authenticationProvider
      ->applies($request) && !$this->filter
      ->appliesToRoutedRequest($request, TRUE)) {
      throw new AccessDeniedHttpException();
    }
  }
}