-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Security] Logout success_handler
is called **before** the actual logout happens
#36227
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
What's the actual bug here? Changing this could break handlers relying on the token still existing when having the token storage as (implicit) dependency. |
To be honest, a logout is always a success. Calling I don't see, apart from naming semantics, how calling the LogoutSuccessHandler's behaviour is affected by being called before or after the token is reset. However, the side-effects are affected by changing the position. So this is a clear BC break. Can you maybe share why in your situation this matters? Maybe that can help shed some light on why a BC break should be needed here. |
I have:
Result: Since the Response is created when the token is still there, the final page says:
Can it be that this "bug" is the very reason why the Maybe the token could be passed as second (optional) argument to |
|
Symfony version(s) affected: 4.4.5
Description
Logout
success_handler
is called before the actual logout happens.Here's the problem:
https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/Security/Http/Firewall/LogoutListener.php#L95
The Response is created too early, since the actual logout is only happening below.
Reference at https://symfony.com/doc/4.4/reference/configuration/security.html#success-handler is saying that this is for "handling a successful logout." (Which is also in line with my understanding of a "success handler" and the semantics of
onLogoutSuccess
.) But this is not the case, cause until it has actually happened, there is no successful logout (but merely a pending logout).So I'm suggesting to move
$this->tokenStorage->setToken(null);
https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/Security/Http/Firewall/LogoutListener.php#L107 above the$response = ...
line.The text was updated successfully, but these errors were encountered: