1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474
|
From: Christian Flothmann <christian.flothmann@sensiolabs.de>
Date: Fri, 18 May 2018 19:27:18 +0200
Subject: clear CSRF tokens when the user is logged out
[CVE-2018-11406] https://symfony.com/blog/cve-2018-11406-csrf-token-fixation
Origin: backport, https://github.com/symfony/symfony/commit/4b91c171af18ea2fb40200b05bed325cbfaf5ba5
---
.../RegisterCsrfTokenClearingLogoutHandlerPass.php | 42 ++++++++++++
.../Bundle/SecurityBundle/SecurityBundle.php | 2 +
.../SecurityBundle/Tests/Functional/LogoutTest.php | 18 +++++
.../LogoutWithoutSessionInvalidation/bundles.php | 18 +++++
.../LogoutWithoutSessionInvalidation/config.yml | 26 ++++++++
.../LogoutWithoutSessionInvalidation/routing.yml | 5 ++
.../TokenStorage/NativeSessionTokenStorageTest.php | 28 ++++++++
.../Tests/TokenStorage/SessionTokenStorageTest.php | 27 ++++++++
.../ClearableTokenStorageInterface.php | 23 +++++++
.../TokenStorage/NativeSessionTokenStorage.php | 10 ++-
.../Csrf/TokenStorage/SessionTokenStorage.php | 14 +++-
.../Http/Logout/CsrfTokenClearingLogoutHandler.php | 35 ++++++++++
.../Logout/CsrfTokenClearingLogoutHandlerTest.php | 76 ++++++++++++++++++++++
13 files changed, 322 insertions(+), 2 deletions(-)
create mode 100644 src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/RegisterCsrfTokenClearingLogoutHandlerPass.php
create mode 100644 src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/LogoutWithoutSessionInvalidation/bundles.php
create mode 100644 src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/LogoutWithoutSessionInvalidation/config.yml
create mode 100644 src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/LogoutWithoutSessionInvalidation/routing.yml
create mode 100644 src/Symfony/Component/Security/Csrf/TokenStorage/ClearableTokenStorageInterface.php
create mode 100644 src/Symfony/Component/Security/Http/Logout/CsrfTokenClearingLogoutHandler.php
create mode 100644 src/Symfony/Component/Security/Http/Tests/Logout/CsrfTokenClearingLogoutHandlerTest.php
diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/RegisterCsrfTokenClearingLogoutHandlerPass.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/RegisterCsrfTokenClearingLogoutHandlerPass.php
new file mode 100644
index 0000000..d4d28ec
--- /dev/null
+++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/RegisterCsrfTokenClearingLogoutHandlerPass.php
@@ -0,0 +1,42 @@
+<?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\Bundle\SecurityBundle\DependencyInjection\Compiler;
+
+use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\Reference;
+
+/**
+ * @author Christian Flothmann <christian.flothmann@sensiolabs.de>
+ */
+class RegisterCsrfTokenClearingLogoutHandlerPass implements CompilerPassInterface
+{
+ public function process(ContainerBuilder $container)
+ {
+ if (!$container->has('security.logout_listener') || !$container->has('security.csrf.token_storage')) {
+ return;
+ }
+
+ $csrfTokenStorage = $container->findDefinition('security.csrf.token_storage');
+ $csrfTokenStorageClass = $container->getParameterBag()->resolveValue($csrfTokenStorage->getClass());
+
+ if (!is_subclass_of($csrfTokenStorageClass, 'Symfony\Component\Security\Csrf\TokenStorage\ClearableTokenStorageInterface')) {
+ return;
+ }
+
+ $container->register('security.logout.handler.csrf_token_clearing', 'Symfony\Component\Security\Http\Logout\CsrfTokenClearingLogoutHandler')
+ ->addArgument(new Reference('security.csrf.token_storage'))
+ ->setPublic(false);
+
+ $container->findDefinition('security.logout_listener')->addMethodCall('addHandler', array(new Reference('security.logout.handler.csrf_token_clearing')));
+ }
+}
diff --git a/src/Symfony/Bundle/SecurityBundle/SecurityBundle.php b/src/Symfony/Bundle/SecurityBundle/SecurityBundle.php
index 61649f3..bee07f3 100644
--- a/src/Symfony/Bundle/SecurityBundle/SecurityBundle.php
+++ b/src/Symfony/Bundle/SecurityBundle/SecurityBundle.php
@@ -11,6 +11,7 @@
namespace Symfony\Bundle\SecurityBundle;
+use Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler\RegisterCsrfTokenClearingLogoutHandlerPass;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -58,5 +59,6 @@ class SecurityBundle extends Bundle
$extension->addUserProviderFactory(new LdapFactory());
$container->addCompilerPass(new AddSecurityVotersPass());
$container->addCompilerPass(new AddSessionDomainConstraintPass(), PassConfig::TYPE_AFTER_REMOVING);
+ $container->addCompilerPass(new RegisterCsrfTokenClearingLogoutHandlerPass());
}
}
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LogoutTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LogoutTest.php
index 7eeb7c2..d3c3b77 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LogoutTest.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/LogoutTest.php
@@ -31,4 +31,22 @@ class LogoutTest extends WebTestCase
$this->assertNull($cookieJar->get('REMEMBERME'));
}
+
+ public function testCsrfTokensAreClearedOnLogout()
+ {
+ $client = $this->createClient(array('test_case' => 'LogoutWithoutSessionInvalidation', 'root_config' => 'config.yml'));
+ $client->getContainer()->get('security.csrf.token_storage')->setToken('foo', 'bar');
+
+ $client->request('POST', '/login', array(
+ '_username' => 'johannes',
+ '_password' => 'test',
+ ));
+
+ $this->assertTrue($client->getContainer()->get('security.csrf.token_storage')->hasToken('foo'));
+ $this->assertSame('bar', $client->getContainer()->get('security.csrf.token_storage')->getToken('foo'));
+
+ $client->request('GET', '/logout');
+
+ $this->assertFalse($client->getContainer()->get('security.csrf.token_storage')->hasToken('foo'));
+ }
}
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/LogoutWithoutSessionInvalidation/bundles.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/LogoutWithoutSessionInvalidation/bundles.php
new file mode 100644
index 0000000..d90f774
--- /dev/null
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/LogoutWithoutSessionInvalidation/bundles.php
@@ -0,0 +1,18 @@
+<?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.
+ */
+
+use Symfony\Bundle\SecurityBundle\SecurityBundle;
+use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
+
+return array(
+ new FrameworkBundle(),
+ new SecurityBundle(),
+);
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/LogoutWithoutSessionInvalidation/config.yml b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/LogoutWithoutSessionInvalidation/config.yml
new file mode 100644
index 0000000..d3fd8d0
--- /dev/null
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/LogoutWithoutSessionInvalidation/config.yml
@@ -0,0 +1,26 @@
+imports:
+ - { resource: ./../config/framework.yml }
+
+security:
+ encoders:
+ Symfony\Component\Security\Core\User\User: plaintext
+
+ providers:
+ in_memory:
+ memory:
+ users:
+ johannes: { password: test, roles: [ROLE_USER] }
+
+ firewalls:
+ default:
+ form_login:
+ check_path: login
+ remember_me: true
+ require_previous_session: false
+ remember_me:
+ always_remember_me: true
+ key: key
+ logout:
+ invalidate_session: false
+ anonymous: ~
+ stateless: true
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/LogoutWithoutSessionInvalidation/routing.yml b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/LogoutWithoutSessionInvalidation/routing.yml
new file mode 100644
index 0000000..1dddfca
--- /dev/null
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/LogoutWithoutSessionInvalidation/routing.yml
@@ -0,0 +1,5 @@
+login:
+ path: /login
+
+logout:
+ path: /logout
diff --git a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php
index 7d3a537..52e6744 100644
--- a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php
+++ b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php
@@ -123,4 +123,32 @@ class NativeSessionTokenStorageTest extends \PHPUnit_Framework_TestCase
$this->assertSame('TOKEN', $this->storage->removeToken('token_id'));
$this->assertFalse($this->storage->hasToken('token_id'));
}
+
+ public function testClearRemovesAllTokensFromTheConfiguredNamespace()
+ {
+ $this->storage->setToken('foo', 'bar');
+ $this->storage->clear();
+
+ $this->assertFalse($this->storage->hasToken('foo'));
+ $this->assertArrayNotHasKey(self::SESSION_NAMESPACE, $_SESSION);
+ }
+
+ public function testClearDoesNotRemoveSessionValuesFromOtherNamespaces()
+ {
+ $_SESSION['foo']['bar'] = 'baz';
+ $this->storage->clear();
+
+ $this->assertArrayHasKey('foo', $_SESSION);
+ $this->assertArrayHasKey('bar', $_SESSION['foo']);
+ $this->assertSame('baz', $_SESSION['foo']['bar']);
+ }
+
+ public function testClearDoesNotRemoveNonNamespacedSessionValues()
+ {
+ $_SESSION['foo'] = 'baz';
+ $this->storage->clear();
+
+ $this->assertArrayHasKey('foo', $_SESSION);
+ $this->assertSame('baz', $_SESSION['foo']);
+ }
}
diff --git a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/SessionTokenStorageTest.php b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/SessionTokenStorageTest.php
index 9ba1ab2..967c1ec 100644
--- a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/SessionTokenStorageTest.php
+++ b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/SessionTokenStorageTest.php
@@ -128,4 +128,31 @@ class SessionTokenStorageTest extends \PHPUnit_Framework_TestCase
$this->assertSame('TOKEN', $this->storage->removeToken('token_id'));
}
+
+ public function testClearRemovesAllTokensFromTheConfiguredNamespace()
+ {
+ $this->storage->setToken('foo', 'bar');
+ $this->storage->clear();
+
+ $this->assertFalse($this->storage->hasToken('foo'));
+ $this->assertFalse($this->session->has(self::SESSION_NAMESPACE.'/foo'));
+ }
+
+ public function testClearDoesNotRemoveSessionValuesFromOtherNamespaces()
+ {
+ $this->session->set('foo/bar', 'baz');
+ $this->storage->clear();
+
+ $this->assertTrue($this->session->has('foo/bar'));
+ $this->assertSame('baz', $this->session->get('foo/bar'));
+ }
+
+ public function testClearDoesNotRemoveNonNamespacedSessionValues()
+ {
+ $this->session->set('foo', 'baz');
+ $this->storage->clear();
+
+ $this->assertTrue($this->session->has('foo'));
+ $this->assertSame('baz', $this->session->get('foo'));
+ }
}
diff --git a/src/Symfony/Component/Security/Csrf/TokenStorage/ClearableTokenStorageInterface.php b/src/Symfony/Component/Security/Csrf/TokenStorage/ClearableTokenStorageInterface.php
new file mode 100644
index 0000000..0d6f16b
--- /dev/null
+++ b/src/Symfony/Component/Security/Csrf/TokenStorage/ClearableTokenStorageInterface.php
@@ -0,0 +1,23 @@
+<?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;
+
+/**
+ * @author Christian Flothmann <christian.flothmann@sensiolabs.de>
+ */
+interface ClearableTokenStorageInterface extends TokenStorageInterface
+{
+ /**
+ * Removes all CSRF tokens.
+ */
+ public function clear();
+}
diff --git a/src/Symfony/Component/Security/Csrf/TokenStorage/NativeSessionTokenStorage.php b/src/Symfony/Component/Security/Csrf/TokenStorage/NativeSessionTokenStorage.php
index 2620156..e4618fc 100644
--- a/src/Symfony/Component/Security/Csrf/TokenStorage/NativeSessionTokenStorage.php
+++ b/src/Symfony/Component/Security/Csrf/TokenStorage/NativeSessionTokenStorage.php
@@ -20,7 +20,7 @@ use Symfony\Component\Security\Csrf\Exception\TokenNotFoundException;
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
-class NativeSessionTokenStorage implements TokenStorageInterface
+class NativeSessionTokenStorage implements ClearableTokenStorageInterface
{
/**
* The namespace used to store values in the session.
@@ -108,6 +108,14 @@ class NativeSessionTokenStorage implements TokenStorageInterface
return $token;
}
+ /**
+ * {@inheritdoc}
+ */
+ public function clear()
+ {
+ unset($_SESSION[$this->namespace]);
+ }
+
private function startSession()
{
if (PHP_VERSION_ID >= 50400) {
diff --git a/src/Symfony/Component/Security/Csrf/TokenStorage/SessionTokenStorage.php b/src/Symfony/Component/Security/Csrf/TokenStorage/SessionTokenStorage.php
index a6a6ea3..251aa94 100644
--- a/src/Symfony/Component/Security/Csrf/TokenStorage/SessionTokenStorage.php
+++ b/src/Symfony/Component/Security/Csrf/TokenStorage/SessionTokenStorage.php
@@ -21,7 +21,7 @@ use Symfony\Component\Security\Csrf\Exception\TokenNotFoundException;
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
-class SessionTokenStorage implements TokenStorageInterface
+class SessionTokenStorage implements ClearableTokenStorageInterface
{
/**
* The namespace used to store values in the session.
@@ -106,4 +106,16 @@ class SessionTokenStorage implements TokenStorageInterface
return $this->session->remove($this->namespace.'/'.$tokenId);
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function clear()
+ {
+ foreach (array_keys($this->session->all()) as $key) {
+ if (0 === strpos($key, $this->namespace.'/')) {
+ $this->session->remove($key);
+ }
+ }
+ }
}
diff --git a/src/Symfony/Component/Security/Http/Logout/CsrfTokenClearingLogoutHandler.php b/src/Symfony/Component/Security/Http/Logout/CsrfTokenClearingLogoutHandler.php
new file mode 100644
index 0000000..ad6b888
--- /dev/null
+++ b/src/Symfony/Component/Security/Http/Logout/CsrfTokenClearingLogoutHandler.php
@@ -0,0 +1,35 @@
+<?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\Http\Logout;
+
+use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpFoundation\Response;
+use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
+use Symfony\Component\Security\Csrf\TokenStorage\ClearableTokenStorageInterface;
+
+/**
+ * @author Christian Flothmann <christian.flothmann@sensiolabs.de>
+ */
+class CsrfTokenClearingLogoutHandler implements LogoutHandlerInterface
+{
+ private $csrfTokenStorage;
+
+ public function __construct(ClearableTokenStorageInterface $csrfTokenStorage)
+ {
+ $this->csrfTokenStorage = $csrfTokenStorage;
+ }
+
+ public function logout(Request $request, Response $response, TokenInterface $token)
+ {
+ $this->csrfTokenStorage->clear();
+ }
+}
diff --git a/src/Symfony/Component/Security/Http/Tests/Logout/CsrfTokenClearingLogoutHandlerTest.php b/src/Symfony/Component/Security/Http/Tests/Logout/CsrfTokenClearingLogoutHandlerTest.php
new file mode 100644
index 0000000..fe34eaa
--- /dev/null
+++ b/src/Symfony/Component/Security/Http/Tests/Logout/CsrfTokenClearingLogoutHandlerTest.php
@@ -0,0 +1,76 @@
+<?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\Http\Tests\Logout;
+
+use PHPUnit\Framework\TestCase;
+use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpFoundation\Response;
+use Symfony\Component\HttpFoundation\Session\Session;
+use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
+use Symfony\Component\Security\Csrf\TokenStorage\SessionTokenStorage;
+use Symfony\Component\Security\Http\Logout\CsrfTokenClearingLogoutHandler;
+
+class CsrfTokenClearingLogoutHandlerTest extends TestCase
+{
+ private $session;
+ private $csrfTokenStorage;
+ private $csrfTokenClearingLogoutHandler;
+
+ protected function setUp()
+ {
+ $this->session = new Session(new MockArraySessionStorage());
+ $this->csrfTokenStorage = new SessionTokenStorage($this->session, 'foo');
+ $this->csrfTokenStorage->setToken('foo', 'bar');
+ $this->csrfTokenStorage->setToken('foobar', 'baz');
+ $this->csrfTokenClearingLogoutHandler = new CsrfTokenClearingLogoutHandler($this->csrfTokenStorage);
+ }
+
+ public function testCsrfTokenCookieWithSameNamespaceIsRemoved()
+ {
+ $this->assertSame('bar', $this->session->get('foo/foo'));
+ $this->assertSame('baz', $this->session->get('foo/foobar'));
+
+ $this->csrfTokenClearingLogoutHandler->logout(new Request(), new Response(), $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock());
+
+ $this->assertFalse($this->csrfTokenStorage->hasToken('foo'));
+ $this->assertFalse($this->csrfTokenStorage->hasToken('foobar'));
+
+ $this->assertFalse($this->session->has('foo/foo'));
+ $this->assertFalse($this->session->has('foo/foobar'));
+ }
+
+ public function testCsrfTokenCookieWithDifferentNamespaceIsNotRemoved()
+ {
+ $barNamespaceCsrfSessionStorage = new SessionTokenStorage($this->session, 'bar');
+ $barNamespaceCsrfSessionStorage->setToken('foo', 'bar');
+ $barNamespaceCsrfSessionStorage->setToken('foobar', 'baz');
+
+ $this->assertSame('bar', $this->session->get('foo/foo'));
+ $this->assertSame('baz', $this->session->get('foo/foobar'));
+ $this->assertSame('bar', $this->session->get('bar/foo'));
+ $this->assertSame('baz', $this->session->get('bar/foobar'));
+
+ $this->csrfTokenClearingLogoutHandler->logout(new Request(), new Response(), $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock());
+
+ $this->assertTrue($barNamespaceCsrfSessionStorage->hasToken('foo'));
+ $this->assertTrue($barNamespaceCsrfSessionStorage->hasToken('foobar'));
+ $this->assertSame('bar', $barNamespaceCsrfSessionStorage->getToken('foo'));
+ $this->assertSame('baz', $barNamespaceCsrfSessionStorage->getToken('foobar'));
+ $this->assertFalse($this->csrfTokenStorage->hasToken('foo'));
+ $this->assertFalse($this->csrfTokenStorage->hasToken('foobar'));
+
+ $this->assertFalse($this->session->has('foo/foo'));
+ $this->assertFalse($this->session->has('foo/foobar'));
+ $this->assertSame('bar', $this->session->get('bar/foo'));
+ $this->assertSame('baz', $this->session->get('bar/foobar'));
+ }
+}
|