eZ\Bundle\EzPublishRestBundle\EventListener\CsrfListener::checkCsrfToken PHP Method

checkCsrfToken() protected method

Checks the validity of the request's csrf token header.
protected checkCsrfToken ( Request $request ) : boolean
$request Symfony\Component\HttpFoundation\Request
return boolean true/false if the token is valid/invalid, false if none was found in the request's headers.
    protected function checkCsrfToken(Request $request)
    {
        if (!$request->headers->has(self::CSRF_TOKEN_HEADER)) {
            return false;
        }
        return $this->csrfTokenManager->isTokenValid(new CsrfToken($this->csrfTokenIntention, $request->headers->get(self::CSRF_TOKEN_HEADER)));
    }