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

Skip to content

Commit 7cac631

Browse files
committed
[Security] Fix AuthenticationTrustResolver::isAnonymous()
1 parent f638ea5 commit 7cac631

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Security\Core\Authentication;
1313

1414
use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken;
15+
use Symfony\Component\Security\Core\Authentication\Token\NullToken;
1516
use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken;
1617
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
1718

@@ -38,7 +39,7 @@ public function isAnonymous(TokenInterface $token = null/*, $deprecation = true*
3839
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__);
3940
}
4041

41-
return $token && !$this->isAuthenticated($token);
42+
return $token instanceof AnonymousToken || $token instanceof NullToken || ($token && !$token->getUser());
4243
}
4344

4445
/**

0 commit comments

Comments
 (0)