/**
* Denies access if authentication provider is not allowed on this route.
*
* @param \Symfony\Component\HttpKernel\Event\RequestEvent $event
* The request event.
*/
public function onKernelRequestFilterProvider(RequestEvent
$event) { if (isset($this->filter
) &&
$event->
isMainRequest()) { $request =
$event->
getRequest();
if ($this->authenticationProvider->
applies($request) && !
$this->filter->
appliesToRoutedRequest($request, TRUE
)) { throw new AccessDeniedHttpException('The used authentication method is not allowed on this route.'
);
} } } /**
* Respond with a challenge on access denied exceptions if appropriate.
*
* On a 403 (access denied), if there are no credentials on the request, some
* authentication methods (e.g. basic auth) require that a challenge is sent
* to the client.
*
* @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $event
* The exception event.
*/