public function AuthenticationSubscriber::onKernelRequestFilterProvider

public AuthenticationSubscriber::onKernelRequestFilterProvider(GetResponseEvent $event)

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 95

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();
    }
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!EventSubscriber!AuthenticationSubscriber.php/function/AuthenticationSubscriber::onKernelRequestFilterProvider/8.1.x