-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[WIP] [Security] Session concurrency control #12009
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
Conversation
|
||
while ($data = $statement->fetch(\PDO::FETCH_ASSOC)) { | ||
$sessionInformations[] = $this->instantiateSessionInformationFromResultSet($data); | ||
} |
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.
you should call $statement->closeCursor()
at the end of the iteration to close the cursor so that memory can be reclaimed by the DB driver
Impressive work @ajgarlag! It's a really big PR and targets one of the most difficult parts of Symfony. |
Thanks @javiereguiluz. I've fought with the Security component several times in the past, but I think I will never understand it fully. Anyway, this PR couldn't be possible without the previous work by @paschke in #786. |
54e2d41
to
fccc826
Compare
4fda8da
to
24c2120
Compare
@fabpot @schmittjoh Any feedback for this |
Hey! look at #12284 for CS ! |
… the Spring framework name. Rename allowableSessionsExceeded to allowedSessionsExceeded.
24c2120
to
4ca3a47
Compare
…sion registry on logout.
After reviewing the PR, I've discovered that two different concerns are involved here, so I've split it in two different PRs. I close this PR in favor of the other ones:
|
This PR is based on #786 by @paschke. The most important changes from this PR are listed below:
Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface
to maintain BC.Symfony\Bridge\Doctrine\Security\SessionRegistry\SessionRegistryStorage
is borrowed fromSymfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler
Symfony\Component\Security\Http\Session\CompositeSessionAuthenticationStrategy
class exits to wrap the actual SessionAuthenticationStrategy, and to split the concurrency control in two steps: the first one checks the concurrency, the last one registers the session information in the registry.firewalls.secured_area.session_concurrency.error_if_maximum_exceeded
allows you to configure the default behaviour when session concurrency is detected: to avoid a new login, or to expire the oldest sessions.Symfony\Component\Security\Http\Firewall\ConcurrentSessionListener
is renamed toSymfony\Component\Security\Http\Firewall\ExpiredSessionListener