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

Skip to content

Commit 81c2007

Browse files
minor #42732 [Security] Fix AuthenticationTrustResolver::isAnonymous() (chalasr)
This PR was merged into the 5.4 branch. Discussion ---------- [Security] Fix AuthenticationTrustResolver::isAnonymous() | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | #42726 | License | MIT | Doc PR | - This method wasn't checking if a token is null nor `$token->isAuthenticated()` until #42650. Reverting that behavior change fixes tests on both 5.3 and 5.4 Commits ------- 83da786 [Security] Fix AuthenticationTrustResolver::isAnonymous()
2 parents 2310fc8 + 83da786 commit 81c2007

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/Security/Core/Authentication/AuthenticationTrustResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function isAnonymous(TokenInterface $token = null/*, $deprecation = true*
3838
trigger_deprecation('symfony/security-core', '5.4', 'The "%s()" method is deprecated, use "isAuthenticated()" or "isFullFledged()" if you want to check if the request is (fully) authenticated.', __METHOD__);
3939
}
4040

41-
return $token && !$this->isAuthenticated($token);
41+
return $token instanceof AnonymousToken || ($token && !$token->getUser());
4242
}
4343

4444
/**

0 commit comments

Comments
 (0)