private function checkCsrf($tokenValue)
    {
        /** @var \Symfony\Component\Security\Csrf\CsrfTokenManager $csrfTokenManager */
        $csrfTokenManager = $this->get('security.csrf.token_manager');

        $token = new CsrfToken('datagrid', $tokenValue);

        if (!$csrfTokenManager->isTokenValid($token)) {
            throw new AccessDeniedException('Invalid token');
        }
    }
private function checkCsrf($tokenValue)
    {
        /** @var \Symfony\Component\Security\Csrf\CsrfTokenManager $csrfTokenManager */
        $csrfTokenManager = $this->get('security.csrf.token_manager');

        $token = new CsrfToken('datagrid', $tokenValue);

        if (!$csrfTokenManager->isTokenValid($token)) {
            throw new AccessDeniedException('Invalid token');
        }
    }
private function checkCsrf ( $ tokenValue ) { /** @var \Symfony\Component\Security\Csrf\CsrfTokenManager $csrfTokenManager */ $ csrfTokenManager = $ this -> get ( 'security.csrf.token_manager' ) ; $ token = new CsrfToken ( 'datagrid' , $ tokenValue ) ; if ( ! $ csrfTokenManager -> isTokenValid ( $ token ) ) { throw new AccessDeniedException ( 'Invalid token' ) ; } }
Check provided token is valid to prevent csrf attacks

@throws AccessDeniedException if the token cannot be verified

@param String $tokenValue
Check provided token is valid to prevent csrf attacks