public function onKernelRequest(GetResponseEvent $event)
    {
        if (
            HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()
            ||
            $this->routeMatcher->match($event->getRequest(), $this->exclude)
            ||
            !$this->routeMatcher->match($event->getRequest(), $this->routes)
        ) {
            return;
        }

        $value = $event->getRequest()->headers->get($this->headerName);
        if (!$value || !$this->angularCsrfTokenManager->isTokenValid($value)) {
            throw new AccessDeniedHttpException('Bad CSRF token.');
        }
    }
public function onKernelRequest(GetResponseEvent $event)
    {
        if (
            HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()
            ||
            $this->routeMatcher->match($event->getRequest(), $this->exclude)
            ||
            !$this->routeMatcher->match($event->getRequest(), $this->routes)
        ) {
            return;
        }

        $value = $event->getRequest()->headers->get($this->headerName);
        if (!$value || !$this->angularCsrfTokenManager->isTokenValid($value)) {
            throw new AccessDeniedHttpException('Bad CSRF token.');
        }
    }
public function onKernelRequest ( GetResponseEvent $ event ) { if ( HttpKernelInterface :: MASTER_REQUEST !== $ event -> getRequestType ( ) || $ this -> routeMatcher -> match ( $ event -> getRequest ( ) , $ this -> exclude ) || ! $ this -> routeMatcher -> match ( $ event -> getRequest ( ) , $ this -> routes ) ) { return ; } $ value = $ event -> getRequest ( ) -> headers -> get ( $ this -> headerName ) ; if ( ! $ value || ! $ this -> angularCsrfTokenManager -> isTokenValid ( $ value ) ) { throw new AccessDeniedHttpException ( 'Bad CSRF token.' ) ; } }
Handles CSRF token validation.

@param GetResponseEvent $event

@throws AccessDeniedHttpException
Handles CSRF token validation .