diff --git a/src/Symfony/Component/Security/Http/Firewall/ContextListener.php b/src/Symfony/Component/Security/Http/Firewall/ContextListener.php index 97abd4dce5622..cd26d83ef7291 100644 --- a/src/Symfony/Component/Security/Http/Firewall/ContextListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/ContextListener.php @@ -23,6 +23,7 @@ use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; use Symfony\Component\Security\Core\Exception\UnsupportedUserException; +use Symfony\Component\Security\Core\Role\SwitchUserRole; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\UserProviderInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -91,7 +92,10 @@ public function handle(GetResponseEvent $event) $token = unserialize($token); if (null !== $this->logger) { - $this->logger->debug('Read existing security token from the session.', array('key' => $this->sessionKey)); + $this->logger->debug('Read existing security token from the session.', array( + 'key' => $this->sessionKey, + 'token_class' => is_object($token) ? get_class($token) : null, + )); } if ($token instanceof TokenInterface) { @@ -169,7 +173,16 @@ protected function refreshUser(TokenInterface $token) $token->setUser($refreshedUser); if (null !== $this->logger) { - $this->logger->debug('User was reloaded from a user provider.', array('username' => $refreshedUser->getUsername(), 'provider' => get_class($provider))); + $context = array('provider' => get_class($provider), 'username' => $refreshedUser->getUsername()); + + foreach ($token->getRoles() as $role) { + if ($role instanceof SwitchUserRole) { + $context['impersonator_username'] = $role->getSource()->getUsername(); + break; + } + } + + $this->logger->debug('User was reloaded from a user provider.', $context); } return $token; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy