Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Security] Deprecate remaining anonymous checks#42510

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:5.4fromwouterj:pull-41613/anon
Aug 14, 2021

Conversation

@wouterj
Copy link
Member

@wouterjwouterj commentedAug 12, 2021
edited by chalasr
Loading

QA
Branch?5.4
Bug fix?no
New feature?yes
Deprecations?yes
TicketsRef#41613
LicenseMIT
Doc PRtbd

Deprecates the remaining checks for anonymous found in#41613. It's WIP because the tests are failing until#42423 is merged and this PR is rebased (didn't update one test to avoid merge conflicts).

Besides this, it also introducedIS_AUTHENTICATED andAuthenticationTrustResolver::isAutenticated(). Previously,IS_AUTHENTICATED_ANONYMOUSLY was considered to be the "bottom type" for authenticated requests. As this is no longer true,IS_AUTHENTICATED_REMEMBERME is now the new "bottom type". I suggest we use an explicit bottom type (the ones introduced) instead to avoid another such update if we change something with remember me. It's also more clear on the exact intent of the check.

@chalasrchalasr changed the title[Security] [WIP] Deprecate removing anonymous checks[Security] [WIP] Deprecate relai anonymous checksAug 12, 2021
@chalasrchalasr changed the title[Security] [WIP] Deprecate relai anonymous checks[Security] [WIP] Deprecate remaining anonymous checksAug 12, 2021
Copy link
Member

@NyholmNyholm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thank you. Well done

After first review, It looks good. Just waiting for it to remove WIP.

@wouterj
Copy link
MemberAuthor

Thanks for the reviews@Nyholm!

Just waiting for it to remove WIP

The WIP is just because of the intentionally broken tests. Everything exceptExpressionLanguageTest is in the final state as far as I'm concerned.

Nyholm reacted with thumbs up emoji

@chalasr
Copy link
Member

The most common usage ofIS_AUTHENTICATED_ANONYMOUSLY looks like:

firewalls:main:pattern:^/form_login:login_path:logincheck_path:loginaccess_control:    -{ path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }    -{ path: ^/another_public_resource, roles: IS_AUTHENTICATED_ANONYMOUSLY }    -{ path: ^/, roles: IS_AUTHENTICATED_FULLY }

What is the new way to achieve that? How should one allow a single route to be accessed without being authenticated?
I think having such before/after example in the UPGRADE file would be useful.

@fabpot
Copy link
Member

#42423 has been merged now.

@wouterjwouterjforce-pushed thepull-41613/anon branch 2 times, most recently fromd6de7d5 toab23e6fCompareAugust 14, 2021 09:17
@wouterj
Copy link
MemberAuthor

Good idea@chalasr. The great thing: this made me realize that I was suggesting a wrong replacement. I've added your example to the UPGRADE guide.

Meanwhile, I also fixed the tests and updated theisAuthenticated() check to take into account deprecated features (and also make sure to be forward compatible by returningfalse for anonymous).


I think I have to disagree with fabbot here, their suggestion doesn't make sense: (I know we like to use the pixels at the right side of the screen, but I'm going to need a much much wider screen to be able to read this line 😄 )

diff -ru src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php--- src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php2021-08-14 09:17:15.170647398 +0000+++ src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php2021-08-14 09:17:18.381551885 +0000@@ -416,11 +416,9 @@          $tokenStorage = new TokenStorage();         $usageIndex = $session->getUsageIndex();-        $tokenStorage = new UsageTrackingTokenStorage($tokenStorage, new class(-            (new \ReflectionClass(UsageTrackingTokenStorage::class))->hasMethod('getSession') ? [-                'request_stack' => function () use ($requestStack) {-                return $requestStack;-            }] : [+        $tokenStorage = new UsageTrackingTokenStorage($tokenStorage, new class((new \ReflectionClass(UsageTrackingTokenStorage::class))->hasMethod('getSession') ? ['request_stack' => function () use ($requestStack) {+            return $requestStack;+        }] : [                 // BC for symfony/framework-bundle < 5.3                 'session' => function () use ($session) {                     return $session;

@wouterjwouterj changed the title[Security] [WIP] Deprecate remaining anonymous checks[Security] Deprecate remaining anonymous checksAug 14, 2021
Copy link
Member

@chalasrchalasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

👍

@fabpot
Copy link
Member

Thank you@wouterj.

nicolas-grekas added a commit that referenced this pull requestAug 20, 2021
…:isAuthenticated()` non-virtual (chalasr)This PR was merged into the 6.0 branch.Discussion----------[Security] Make `AuthenticationTrustResolverInterface::isAuthenticated()` non-virtual| Q             | A| ------------- | ---| Branch?       | 6.0| Bug fix?      | no| New feature?  | no| Deprecations? | no| Tickets       | -| License       | MIT| Doc PR        | -The method has been added in#42510 (5.4) as a replacement for `isAnonymous()`.Commits-------32952ca [Security] Make `AuthenticationTrustResolverInterface::isAuthenticated()` non-virtual
This was referencedNov 5, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@NyholmNyholmNyholm left review comments

@fabpotfabpotfabpot approved these changes

@chalasrchalasrchalasr approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@wouterj@chalasr@fabpot@Nyholm@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp