-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
RememberMe logout handler not auto registered #6751
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
Works fine for me on 2.1.6 and 2.2-beta1. What's in your firewall config? |
Sure, here it is:
|
Also I am working on the beta of sf2.2. Is there anything I could do to fix the problem ? |
Ok, I just fixed it, that was because I did not configure my rememberme handler in the logout section:
As it is not intuitie, I think it should be done automatically. Can you point me on how to to fix so I can submit a PR ? |
Theoretically, you should not set handler manually since RememberMeFactory does it for you, if "logout" and "remember_me" sections are present in your firewall config; and they are. Another question is why it doesn't make what it should. Could you show the output of |
Here with the handler key set:
And without:
|
Ok, so there's one missing, when no handlers specified. Take a look at app/cache/dev/appDevDebugProjectContainerCompiler.log to see what's going on with your security.authentication.rememberme.services.simplehash.main service. |
Yes, the service is inlined several times then removed:
|
I updated the issue to reflect this new development. |
It's okay, as far as I know, since it was inlined. And what about security.logout_listener.main? Also, could you look at app/cache/dev/appDevDebugProjectContainer.php and search for method getSecurity_Firewall_Map_Context_MainService() there. |
Without the manual configuration:
And with the configuration:
As you can see, there is something wrong when adding the handler configuration. The RememberMe service is registered twice and the the chain provider is overriden. So why is the chain user provider breaking the logout handler logic ? |
It's weird. You have identical contexts and I can't see a reason why duplicate logout handler should solve the issue. |
Me too. If someone more proficient un the security component could help us figure it out, it would be very nice. |
Hmm.. Could you show debug log for logout request, again with and without manually set handler? |
I found the mistake. It comes from the fact that the logout listeners are registered too late. Because they handle GetResponseEvent after the login routine, the security context is not provided with a token and thus the logout cannot occurs. |
I am preparing a PR. |
This PR was squashed before being merged into the 2.7 branch (closes #24805). Discussion ---------- [Security] Fix logout | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | no | Fixed tickets | #6751, #7104 | License | MIT Commits ------- 9e88eb5 [Security] Fix logout
Thanks @MatTheCat for fixing this 5 years old bug 🎉 |
I am currently implementing the remember me functionality. The REMEMBERME cookie is correctly set, but the logout fails.
What happens is that the LogoutListener is first called on the GetResponseEvent, but when comming here there is no token in the context, so the remember me logout is not called and does not delete the cookie. On the same listener routine, the remember me service is called later on and thus identifies the user.
Am I doing something wrong, or the listening sequence is wrong ?
EDIT I fixed the issue here, but it was because the remember me service is not registered as a logout handler automatically.
The text was updated successfully, but these errors were encountered: