bundles/BlockManagerAdminBundle/EventListener/AdminAuthenticationExceptionListener.php
public function onException(GetResponseForExceptionEvent $event): void
    {
        $attributes = $event->getRequest()->attributes;
        if ($attributes->get(SetIsAdminRequestListener::ADMIN_FLAG_NAME) !== true) {
            return;
        }

        if (!$event->getRequest()->isXmlHttpRequest()) {
            return;
        }

        $exception = $event->getException();
        if (!$exception instanceof AuthenticationException && !$exception instanceof AccessDeniedException) {
            return;
        }

        $event->setException(new AccessDeniedHttpException());

        $event->stopPropagation();
    }
public function onException(GetResponseForExceptionEvent $event): void
    {
        $attributes = $event->getRequest()->attributes;
        if ($attributes->get(SetIsAdminRequestListener::ADMIN_FLAG_NAME) !== true) {
            return;
        }

        if (!$event->getRequest()->isXmlHttpRequest()) {
            return;
        }

        $exception = $event->getException();
        if (!$exception instanceof AuthenticationException && !$exception instanceof AccessDeniedException) {
            return;
        }

        $event->setException(new AccessDeniedHttpException());

        $event->stopPropagation();
    }
public function onException ( GetResponseForExceptionEvent $ event ) : void { $ attributes = $ event -> getRequest ( ) -> attributes ; if ( $ attributes -> get ( SetIsAdminRequestListener :: ADMIN_FLAG_NAME ) !== true ) { return ; } if ( ! $ event -> getRequest ( ) -> isXmlHttpRequest ( ) ) { return ; } $ exception = $ event -> getException ( ) ; if ( ! $ exception instanceof AuthenticationException && ! $ exception instanceof AccessDeniedException ) { return ; } $ event -> setException ( new AccessDeniedHttpException ( ) ) ; $ event -> stopPropagation ( ) ; }
Converts Symfony authentication exceptions to HTTP Access Denied exception.
Converts Symfony authentication exceptions to HTTP Access Denied exception .