8000 Adding an edge case - this should not happen anyways · symfony/symfony@6c180c7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6c180c7

Browse files
committed
Adding an edge case - this should not happen anyways
1 parent 180e2c7 commit 6c180c7

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Symfony\Component\Security\Core\Exception\AuthenticationException;
99
use Symfony\Component\Security\Core\User\UserInterface;
1010
use Symfony\Component\Security\Core\User\UserProviderInterface;
11+
use Symfony\Component\Security\Guard\Token\GuardTokenInterface;
1112
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
1213

1314
/**
@@ -67,7 +68,7 @@ public function authenticate($credentials, UserProviderInterface $userProvider);
6768
* @see AbstractGuardAuthenticator
6869
* @param UserInterface $user
6970
* @param string $providerKey The provider (i.e. firewall) key
70-
* @return TokenInterface
71+
* @return GuardTokenInterface
7172
*/
7273
public function createAuthenticatedToken(UserInterface $user, $providerKey);
7374

src/Symfony/Component/Security/Guard/Provider/GuardAuthenticationProvider.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ public function authenticate(TokenInterface $token)
6565
* we will return an AnonymousToken to accomplish that.
6666
*/
6767

68+
// this should never happen - but technically, the token is
69+
// authenticated... so it could jsut be returned
70+
if ($token->isAuthenticated()) {
71+
return $token;
72+
}
73+
74+
// cause the logout - the token is not authenticated
6875
return new AnonymousToken($this->providerKey, 'anon.');
6976
}
7077

0 commit comments

Comments
 (0)
0