-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Security] Deprecate TokenInterface::isAuthenticated()
#42050
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
[Security] Deprecate TokenInterface::isAuthenticated()
#42050
Conversation
f4497d8
to
4cfcf3d
Compare
4cfcf3d
to
366e1e7
Compare
This comment has been minimized.
This comment has been minimized.
366e1e7
to
f892331
Compare
src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php
Show resolved
Hide resolved
src/Symfony/Component/Security/Http/Firewall/ContextListener.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Http/Tests/Firewall/AccessListenerTest.php
Outdated
Show resolved
Hide resolved
36b1a3f
to
6a2547f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering: how easy will it be for a bundle to support SF 5 & 6 at the same time? Will they be required to use the API that this PR adds to silence deprecations?
Once a bundle provides an integration for the new authenticator system (available since 5.1, considered stable since 5.3), it really has no reason to use the API that this PR deprecates. The only way for a bundle to support both the old system and the new one is to provide two distinct implementations: For e.g. scheb/2fa or lexik/jwt-authentication-bundle, the only thing needed to be deprecation-free on both 5.x and 6.x is to replace some |
6a2547f
to
55cb0f6
Compare
55cb0f6
to
3fe9eac
Compare
3fe9eac
to
33b8fbd
Compare
Thank you Robin. |
… users, and token credentials (wouterj) This PR was squashed before being merged into the 5.4 branch. Discussion ---------- [Security] Deprecate AnonymousToken, non-UserInterface users, and token credentials | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | yes | Tickets | Ref #41613, #34909 | License | MIT | Doc PR | - This is a continuation of `@xabbuh`'s experiment in #34909 and `@chalasr`'s work in #42050. This hopefully is the last cleanup of `TokenInterface`: * As tokens now always represent an authenticated user (and no longer e.g. the "username" input of the form), we can finally remove the weird `string|\Stringable` union from `Token::getUser()` and other helper methods and require a user to be an instance of `UserInterface`. * For the same reason, we can also deprecate token credentials. I didn't deprecate `Token::eraseCredentials()` as this is still used to remove credentials from `UserInterface`. * Meanwhile, this also deprecated the `AnonymousToken`, which we forgot in 5.3. This token is not used anymore in the new system (anonymous does no longer exists). This was also the only token in core that didn't fulfill the `UserInterface` requirement for authenticated tokens. Commits ------- 44b843a [Security] Deprecate AnonymousToken, non-UserInterface users, and token credentials
…ot an AbstractToken (chalasr) This PR was merged into the 5.4 branch. Discussion ---------- [Security] Do not deauthenticate token on user change if not an AbstractToken | 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. Commits ------- fe31fcb [Security] Do not deauthenticate token on user change if not an AbstractToken
From #41613 (comment)