summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard van Laak <rvanlaak@gmail.com>2015-06-10 09:49:02 +0200
committerChristian Flothmann <christian.flothmann@xabbuh.de>2015-06-28 20:33:21 +0200
commita2d134b9a33886bc190c6eff600d5b937c96b6d0 (patch)
treed3abf3f5f54da56df889e0501d5e8f45d44f62f3
parent5cabfecc4c4b5416e7c54ffe7a4fcde2d0db4d75 (diff)
downloadsymfony-security-a2d134b9a33886bc190c6eff600d5b937c96b6d0.zip
symfony-security-a2d134b9a33886bc190c6eff600d5b937c96b6d0.tar.gz
symfony-security-a2d134b9a33886bc190c6eff600d5b937c96b6d0.tar.bz2
[Security] Initialize SwitchUserEvent::targetUser on attemptExitUser
The `SwitchUserEvent` is triggered in case an account is switched. This works okay while switching to the user, but on exit the `SwitchUserEvent` is triggered again with the original User. That User was not initialized by the provider yet. load user by UserInterface instead of username
-rw-r--r--Http/Firewall/SwitchUserListener.php3
1 files changed, 2 insertions, 1 deletions
diff --git a/Http/Firewall/SwitchUserListener.php b/Http/Firewall/SwitchUserListener.php
index 7700096..c5ecf78 100644
--- a/Http/Firewall/SwitchUserListener.php
+++ b/Http/Firewall/SwitchUserListener.php
@@ -163,7 +163,8 @@ class SwitchUserListener implements ListenerInterface
}
if (null !== $this->dispatcher) {
- $switchEvent = new SwitchUserEvent($request, $original->getUser());
+ $user = $this->provider->refreshUser($original->getUser());
+ $switchEvent = new SwitchUserEvent($request, $user);
$this->dispatcher->dispatch(SecurityEvents::SWITCH_USER, $switchEvent);
}