/**
  * Provide a BC wrapper for CSRF token manager/provider compatibility between versions.
  *
  * @param Request $request
  */
 protected function validateCsrfToken(Request $request)
 {
     if (is_null($this->csrfTokenManager)) {
         return;
     }
     $csrfToken = $this->getParameterFromRequest($request, $this->options['csrf_parameter']);
     if ($this->csrfTokenManager instanceof CsrfTokenManagerInterface) {
         if (false === $this->csrfTokenManager->isTokenValid(new CsrfToken($this->options['intention'], $csrfToken))) {
             throw new InvalidCsrfTokenException('Invalid CSRF token.');
         }
     }
     if ($this->csrfTokenManager instanceof CsrfProviderInterface) {
         if (false === $this->csrfTokenManager->isCsrfTokenValid($this->options['intention'], $csrfToken)) {
             throw new InvalidCsrfTokenException('Invalid CSRF token.');
         }
     }
 }