Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Security] Do not deauthenticate token on user change if not an AbstractToken - #42776

Merged
fabpot merged 1 commit into
symfony:5.4from
chalasr:fix-isauthenticated-layer
Sep 1, 2021
Merged

[Security] Do not deauthenticate token on user change if not an AbstractToken#42776
fabpot merged 1 commit into
symfony:5.4from
chalasr:fix-isauthenticated-layer

Conversation

@chalasr

@chalasr chalasr commented Aug 29, 2021

Copy link
Copy Markdown
Member
Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets -
License MIT
Doc PR -

In #42050, we moved the hasUserChanged() logic used for deauthentication from AbstractToken to ContextListener.
Problem is that this check is now done against on all kind of tokens, whereas it was only for AbstractToken instances before.
That breaks https://github.com/scheb/2fa, tokens get wrongly deauthenticated in the middle of the 2fa auth process.
This fixes it by skipping non-AbstractToken implementations.
We may want to provide a way to opt-in/out the hasUserChanged() logic on a custom token with e.g. a marker interface, but that's not necessarily worth it for now IMHO.

@chalasr
chalasr force-pushed the fix-isauthenticated-layer branch from 511d604 to fe31fcb Compare August 29, 2021 14:26
@carsonbot

Copy link
Copy Markdown

Hey!

I think @dmaicher has recently worked with this code. Maybe they can help review this?

Cheers!

Carsonbot

@fabpot

fabpot commented Sep 1, 2021

Copy link
Copy Markdown
Member

Thank you @chalasr.

@fabpot
fabpot merged commit 3c40300 into symfony:5.4 Sep 1, 2021
@chalasr
chalasr deleted the fix-isauthenticated-layer branch September 1, 2021 13:31
@scheb

scheb commented Sep 1, 2021

Copy link
Copy Markdown
Contributor

Thanks for merging. Will run my test suite somewhen in the next days once I find time for it. I'm relatively confident that this is fixing the issue with 2fa-bundle on Symfony 5.4 πŸ‘

@scheb

scheb commented Sep 4, 2021

Copy link
Copy Markdown
Contributor

Confirmed. 2fa-bundle is all green on the latest 5.4.x-dev, both old security system and authenticator-based system πŸ‘

@fabpot

fabpot commented Sep 4, 2021

Copy link
Copy Markdown
Member

That's great news!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants