Skip to content
This repository has been archived by the owner on Dec 2, 2021. It is now read-only.

Called providers session value is never unset #296

Closed
kriswillis opened this issue Aug 13, 2020 · 4 comments
Closed

Called providers session value is never unset #296

kriswillis opened this issue Aug 13, 2020 · 4 comments
Labels

Comments

@kriswillis
Copy link

Bundle version: 4.18.1
Symfony version: 3.4.43

Description
Once prepareAuthentication() is called for the first time, the firewall/provider combination is recorded under the 2fa_called_providers session key; however, it is never removed after a successful authentication.

If you log out and back in, the 2FA form is displayed but no code is generated/sent out because prepareAuthentication() is not called again due to the presence of the 2fa_called_providers session value from the previous login.

Is the intention for the user to re-use the previous auth code?

Additional Context
I'm using a custom provider, but I don't think that makes any difference. From what I can see, the TwoFactorProviderPreparationRecorder class contains methods for checking if a provider is prepared and recording that a provider is prepared, but nothing for "un-preparing" them.

@kriswillis kriswillis added the Bug label Aug 13, 2020
@scheb
Copy link
Owner

scheb commented Aug 13, 2020

Are you sure about this? To my knowledge, when you log out, the session is terminated. So you start with a fresh new session, that therefore doesn't have the session attribute set.

I believe that's the component responsible for terminating the session: https://github.com/symfony/symfony/blob/3.4/src/Symfony/Component/Security/Http/Logout/SessionLogoutHandler.php

@kriswillis
Copy link
Author

Ah hah, I have invalidate_session set to false in my firewall config. I'll have to investigate why we have it set like this. I can add a logout event subscriber to unset the value if I need to…

Thanks for the super quick response 👍

@scheb
Copy link
Owner

scheb commented Aug 13, 2020

Ah, wasn't aware about that invalidate_session option. Under these circumstances it would actually make sense to unset the value.

scheb added a commit that referenced this issue Aug 13, 2020
@scheb
Copy link
Owner

scheb commented Aug 13, 2020

Well, that was an easy one. v4.18.2 is here for the rescue.

@scheb scheb closed this as completed Aug 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants