bug #9826 fix #9356 [Security] Logger should manipulate the user reloaded from provider (matthieuauger)
This PR was submitted for the 2.2 branch but it was merged into the 2.3 branch instead (closes #9826). Discussion ---------- fix #9356 [Security] Logger should manipulate the user reloaded from provider | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #9356 | License | MIT PR for well explained ticket #9356 by nikolajosipovic Any feedback welcome, this is my first PR to symfony Commits ------- 17b0b34 fix #9356 [Security] Logger should manipulate the user reloaded from provider
This commit is contained in:
commit
0689cab2b9
@ -156,10 +156,11 @@ class ContextListener implements ListenerInterface
|
|||||||
|
|
||||||
foreach ($this->userProviders as $provider) {
|
foreach ($this->userProviders as $provider) {
|
||||||
try {
|
try {
|
||||||
$token->setUser($provider->refreshUser($user));
|
$refreshedUser = $provider->refreshUser($user);
|
||||||
|
$token->setUser($refreshedUser);
|
||||||
|
|
||||||
if (null !== $this->logger) {
|
if (null !== $this->logger) {
|
||||||
$this->logger->debug(sprintf('Username "%s" was reloaded from user provider.', $user->getUsername()));
|
$this->logger->debug(sprintf('Username "%s" was reloaded from user provider.', $refreshedUser->getUsername()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $token;
|
return $token;
|
||||||
@ -167,7 +168,7 @@ class ContextListener implements ListenerInterface
|
|||||||
// let's try the next user provider
|
// let's try the next user provider
|
||||||
} catch (UsernameNotFoundException $notFound) {
|
} catch (UsernameNotFoundException $notFound) {
|
||||||
if (null !== $this->logger) {
|
if (null !== $this->logger) {
|
||||||
$this->logger->warning(sprintf('Username "%s" could not be found.', $user->getUsername()));
|
$this->logger->warning(sprintf('Username "%s" could not be found.', $notFound->getUsername()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
Reference in New Issue
Block a user