summaryrefslogtreecommitdiffstats
path: root/Csrf/TokenStorage/TokenStorageInterface.php
diff options
context:
space:
mode:
Diffstat (limited to 'Csrf/TokenStorage/TokenStorageInterface.php')
-rw-r--r--Csrf/TokenStorage/TokenStorageInterface.php49
1 files changed, 49 insertions, 0 deletions
diff --git a/Csrf/TokenStorage/TokenStorageInterface.php b/Csrf/TokenStorage/TokenStorageInterface.php
new file mode 100644
index 0000000..7dba9e5
--- /dev/null
+++ b/Csrf/TokenStorage/TokenStorageInterface.php
@@ -0,0 +1,49 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Security\Csrf\TokenStorage;
+
+/**
+ * Stores CSRF tokens.
+ *
+ * @since 2.4
+ * @author Bernhard Schussek <bschussek@gmail.com>
+ */
+interface TokenStorageInterface
+{
+ /**
+ * Reads a stored CSRF token.
+ *
+ * @param string $tokenId The token ID
+ * @param mixed $default The value to be returned if no token is set
+ *
+ * @return mixed The stored token or the default value, if no token is set
+ */
+ public function getToken($tokenId, $default = null);
+
+ /**
+ * Stores a CSRF token.
+ *
+ * @param string $tokenId The token ID
+ * @param mixed $token The CSRF token
+ */
+ public function setToken($tokenId, $token);
+
+ /**
+ * Checks whether a token with the given token ID exists.
+ *
+ * @param string $tokenId The token ID
+ *
+ * @return Boolean Returns true if a token is stored for the given token ID,
+ * false otherwise.
+ */
+ public function hasToken($tokenId);
+}