-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Security] reusing AuthorizationChecker in AccessListener #27121
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] reusing AuthorizationChecker in AccessListener #27121
Conversation
src/Symfony/Component/Security/Http/Firewall/AccessListener.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Http/Firewall/AccessListener.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Http/Firewall/AccessListener.php
Outdated
Show resolved
Hide resolved
@nicolas-grekas @iltar @stof can you give an advice against what branch this changes should go? |
635597e
to
5773f71
Compare
@oleg-andreyev fortunately, 2.7 is still maintained until the end of May, so we still have a few weeks. |
But actually, new deprecations are never introduced in bugfix-only releases, so as is, this should go on master (for 4.2). |
My suggestion would be to fix this in 2.7 if it's a bug (which it does sound like), and then a feature for 4.2 to fix the constructor, making it an extra optional argument until the change of signature. |
Ok, I'll prepare my PR for 2.7 as bugfix, and then will prepare PR with deprecation for master |
6c00d2e
to
dbdba7e
Compare
fba0977
to
834785a
Compare
- added deprecation notice about old-signature - added deprecation annotation to properties - added legacy group to old unit tests - added new unit tests - adjusted security.access_listener
834785a
to
d0edc06
Compare
- added deprecation notice about old-signature - added deprecation annotation to properties - added legacy group to old unit tests - added new unit tests - adjusted security.access_listener - updated CHANGELOG.md and UPGRADE-4.2.md
d0edc06
to
23b354e
Compare
- added deprecation notice about old-signature - added deprecation annotation to properties - added legacy group to old unit tests - added new unit tests - adjusted security.access_listener - updated CHANGELOG.md and UPGRADE-4.2.md
f9b5c89
to
5e7ea57
Compare
- added deprecation notice about old-signature - added deprecation annotation to properties - added legacy group to old unit tests - added new unit tests - adjusted security.access_listener - updated CHANGELOG.md and UPGRADE-4.2.md
5e7ea57
to
8215d34
Compare
- added deprecation notice about old-signature - added deprecation annotation to properties - added legacy group to old unit tests - added new unit tests - adjusted security.access_listener
8215d34
to
3af6406
Compare
- added deprecation notice about old-signature - added deprecation annotation to properties - added legacy group to old unit tests - added new unit tests - adjusted security.access_listener
- added deprecation notice about old-signature - added deprecation annotation to properties - added legacy group to old unit tests - added new unit tests - adjusted security.access_listener
fcd8ff7
to
a62740f
Compare
If some of the proposed changes are a bugfix, we need to split this PR: Move everything that is not about the bugfix to a new PR targetting |
This PR got messy, I'm closing it and will provide a cleaner version. |
…ged (oleg-andreyev) This PR was merged into the 4.4 branch. Discussion ---------- #21571 Comparing roles to detected that users has changed | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | License | MIT | Fixed tickets | #21571 (comment) | Docs | symfony/symfony-docs#11457 **Case 1:** User A has roles `foo, bar and admin`, User A is signed-in into application and token is persisted, later another User B with role `admin`, decided to restrict role `admin` for User A, so User A won't lose it's privileges until session is expired or logout, because token is persisted with `roles` and `authenticated=true` and roles are not compared. Ref. to the previous attempt: #27121 Commits ------- 4f4c30d - updated AbstractToken to compare Roles - Updated isEqualTo method to match roles as default User implements EquatableInterface - added test case - bumped symfony/security-core to 4.4
While investigating why
AuthenticationEvents::AUTHENTICATION_SUCCESS
is not dispatched, noticed similarity betweenAccessListener
andAuthorizationChecker
and the only real difference isalwaysAuthenticate
flag.Case 1:
When
UsernamePasswordToken
is serialized it will be serialized with state ofauthenticated
,so when application will load token from session
AccessListener
won't callauthenticate
becauseauthenticated=true
, even ifalwaysAuthenticate=true
Case 2:
User A has roles
foo, bar and admin
, User A is signed-in into application and token is persisted, later another User B with roleadmin
, decided to restrict roleadmin
for User A, so User A won't lose it's privileges until session is expired or logout, because token is persisted withroles
andauthenticated=true
and AccessListener does not callauthenticate
even ifalwaysAuthenticate=true
TODO