-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Container fails with stateless firewalls with the new authenticatior manager enabled #37119
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
Comments
Thanks for the very detailed description! I think there is more trouble here: Seems like I somehow ended up with the complete opposite of what should be done. symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php Lines 171 to 177 in bdc583c
This is now registering the So besides removing the abstract argument you mentioned, I think we should also change this loop to add it for all stateful firewalls. I think it then makes most sense to register the listener on these lines in the symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php Lines 372 to 376 in bdc583c
Would you be up for a PR making the change (as bugfix in 5.1)? If you know how, please also add a regression test so we won't break this in the future. |
…er the new authentication manager (johnvandeweghe) This PR was squashed before being merged into the 5.1 branch. Discussion ---------- [SecurityBundle] Fix the session listener registration under the new authentication manager | Q | A | ------------- | --- | Branch? | 5.1 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #37119 | License | MIT | Doc PR | N/A Fixes the logic that adds session listeners for firewalls to properly add them only for statefull firewalls. Adds tests to confirm that it is only added to statefull ones. Also remove unused abstract field on session listener Commits ------- 936ae9d [SecurityBundle] Fix the session listener registration under the new authentication manager
Symfony version(s) affected: 5.1.0
Description
If a stateless firewall is defined, and the new authenticator manager is enabled the following error occurs:
Some digging appears that the need for the second argument was removed in a recent refactor of the
Symfony\Component\Security\Http\EventListener\SessionStrategyListener
and the\Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension
was updated to no longer add the firewall keys, but in an unrelated refactor changed the service definition inResources/config/security_authenticator.xml
to the following:This appears to be the root of the issue.
How to reproduce
Minimal example repo: https://github.com/johnvandeweghe/sf-session-listener-bug
enable_authenticator_manager: true
tosecurity.yaml
bin/console
script.Possible Solution
Changing the service definition to the following - removing the abstract definition and the second argument - fixes it for me (and matches up with the class code):
Additional context
This doesn't appear to be a problem if there are no stateless firewalls defined, which is likely why it has gone unnoticed during development.
This is my first bug report for Symfony, let me know if any more detail is needed!
The text was updated successfully, but these errors were encountered: