summaryrefslogtreecommitdiffstats
path: root/Http
diff options
context:
space:
mode:
Diffstat (limited to 'Http')
-rw-r--r--Http/Firewall/ContextListener.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/Http/Firewall/ContextListener.php b/Http/Firewall/ContextListener.php
index b3f80b5..c24c879 100644
--- a/Http/Firewall/ContextListener.php
+++ b/Http/Firewall/ContextListener.php
@@ -117,14 +117,16 @@ class ContextListener implements ListenerInterface
}
$request = $event->getRequest();
- $session = $request->hasPreviousSession() ? $request->getSession() : null;
+ $session = $request->getSession();
if (null === $session) {
return;
}
if ((null === $token = $this->context->getToken()) || ($token instanceof AnonymousToken)) {
- $session->remove('_security_'.$this->contextKey);
+ if ($request->hasPreviousSession()) {
+ $session->remove('_security_'.$this->contextKey);
+ }
} else {
$session->set('_security_'.$this->contextKey, serialize($token));
}