summaryrefslogtreecommitdiffstats
path: root/Http
diff options
context:
space:
mode:
authorFabien Potencier <fabien.potencier@gmail.com>2012-08-10 13:48:23 +0200
committerFabien Potencier <fabien.potencier@gmail.com>2012-08-10 13:48:23 +0200
commit3d7bc6981737b48b504afbc9813c1a491cdfa4c1 (patch)
treef2c9431548b7c5758fcd589cd8a0a49554bf32ce /Http
parent554ad6bb1448fdd54274a061d6a9ee8951284078 (diff)
downloadsymfony-security-3d7bc6981737b48b504afbc9813c1a491cdfa4c1.zip
symfony-security-3d7bc6981737b48b504afbc9813c1a491cdfa4c1.tar.gz
symfony-security-3d7bc6981737b48b504afbc9813c1a491cdfa4c1.tar.bz2
merged 2.0
Diffstat (limited to 'Http')
-rw-r--r--Http/Firewall/ContextListener.php23
1 files changed, 15 insertions, 8 deletions
diff --git a/Http/Firewall/ContextListener.php b/Http/Firewall/ContextListener.php
index bb1e308..53b2073 100644
--- a/Http/Firewall/ContextListener.php
+++ b/Http/Firewall/ContextListener.php
@@ -75,19 +75,26 @@ class ContextListener implements ListenerInterface
if (null === $session || null === $token = $session->get('_security_'.$this->contextKey)) {
$this->context->setToken(null);
- } else {
- if (null !== $this->logger) {
- $this->logger->debug('Read SecurityContext from the session');
- }
+ return;
+ }
- $token = unserialize($token);
+ $token = unserialize($token);
- if (null !== $token) {
- $token = $this->refreshUser($token);
+ if (null !== $this->logger) {
+ $this->logger->debug('Read SecurityContext from the session');
+ }
+
+ if ($token instanceof TokenInterface) {
+ $token = $this->refreshUser($token);
+ } elseif (null !== $token) {
+ if (null !== $this->logger) {
+ $this->logger->warn(sprintf('Session includes a "%s" where a security token is expected', is_object($value) ? get_class($value) : gettype($value)));
}
- $this->context->setToken($token);
+ $token = null;
}
+
+ $this->context->setToken($token);
}
/**