-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Security] User refreshment from identical users provider type #12465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Security] User refreshment from identical users provider type #12465
Conversation
} | ||
} | ||
|
||
// if a UsernameNotFoundException has been thrown, there are providers | ||
// associated with the token, but none able to refresh it | ||
if (null !== $lastException) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This breaks CI. Previously, if you hadn't got any userProvider registered there, the code shoud throw an error. Now it retirns null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where do you see this line breaks CI? I don't see any break there https://travis-ci.org/symfony/symfony/jobs/41113847 :/
Previously, if you hadn't got any userProvider registered there, , the code shoud not throw an error : https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Security/Http/Firewall/ContextListener.php#L173.
Previously the code return null.
foreach ($exceptions as $exception) { | ||
list($notFound, $provider) = $exception; | ||
$this->logger->warning(sprintf('Username "%s" could not be found from "%s" provider.', $notFound->getUsername(), get_class($provider))); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a missing return here, like the current code.
closing in favour of #21791 |
This PR was merged into the 2.7 branch. Discussion ---------- [SecurityBundle] only pass relevant user provider | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #4498, #12465, #20401, #21737 | License | MIT | Doc PR | There is no need for the context listener to be aware of all the configured user providers. It must only use the provider for the current firewall (the one identified by the context key passed to the constructor) to refresh the user from the session. Commits ------- d97e07f [SecurityBundle] only pass relevant user provider
When we are using two privoders with the same supported class but with different users, there is a faill because the first
UsernameNotFoundException
will stop the refresh processus.