vendor/sulu/form-bundle/Csrf/DisabledCsrfTokenManager.php line 20

Open in your IDE?
  1. <?php
  2. /*
  3. * This file is part of Sulu.
  4. *
  5. * (c) Sulu GmbH
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. namespace Sulu\Bundle\FormBundle\Csrf;
  11. use Symfony\Component\Security\Csrf\CsrfToken;
  12. use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
  13. /**
  14. * @final
  15. */
  16. class DisabledCsrfTokenManager implements CsrfTokenManagerInterface
  17. {
  18. /**
  19. * @var CsrfTokenManagerInterface
  20. */
  21. private $csrfTokenManager;
  22. public function __construct(CsrfTokenManagerInterface $csrfTokenManager)
  23. {
  24. $this->csrfTokenManager = $csrfTokenManager;
  25. }
  26. /**
  27. * @param string $tokenId
  28. */
  29. public function refreshToken($tokenId): CsrfToken
  30. {
  31. return $this->csrfTokenManager->refreshToken($tokenId);
  32. }
  33. /**
  34. * @param string $tokenId
  35. */
  36. public function removeToken($tokenId): ?string
  37. {
  38. return $this->csrfTokenManager->removeToken($tokenId);
  39. }
  40. public function isTokenValid(CsrfToken $token): bool
  41. {
  42. return $this->csrfTokenManager->isTokenValid($token);
  43. }
  44. /**
  45. * @param string $tokenId
  46. */
  47. public function getToken($tokenId): CsrfToken
  48. {
  49. return new CsrfToken('', null);
  50. }
  51. }