Adding an edge case - this should not happen anyways
This commit is contained in:
parent
180e2c7878
commit
6c180c78da
@ -8,6 +8,7 @@ use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|||||||
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
||||||
use Symfony\Component\Security\Core\User\UserInterface;
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
use Symfony\Component\Security\Core\User\UserProviderInterface;
|
use Symfony\Component\Security\Core\User\UserProviderInterface;
|
||||||
|
use Symfony\Component\Security\Guard\Token\GuardTokenInterface;
|
||||||
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
|
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -67,7 +68,7 @@ interface GuardAuthenticatorInterface extends AuthenticationEntryPointInterface
|
|||||||
* @see AbstractGuardAuthenticator
|
* @see AbstractGuardAuthenticator
|
||||||
* @param UserInterface $user
|
* @param UserInterface $user
|
||||||
* @param string $providerKey The provider (i.e. firewall) key
|
* @param string $providerKey The provider (i.e. firewall) key
|
||||||
* @return TokenInterface
|
* @return GuardTokenInterface
|
||||||
*/
|
*/
|
||||||
public function createAuthenticatedToken(UserInterface $user, $providerKey);
|
public function createAuthenticatedToken(UserInterface $user, $providerKey);
|
||||||
|
|
||||||
|
@ -65,6 +65,13 @@ class GuardAuthenticationProvider implements AuthenticationProviderInterface
|
|||||||
* we will return an AnonymousToken to accomplish that.
|
* we will return an AnonymousToken to accomplish that.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// this should never happen - but technically, the token is
|
||||||
|
// authenticated... so it could jsut be returned
|
||||||
|
if ($token->isAuthenticated()) {
|
||||||
|
return $token;
|
||||||
|
}
|
||||||
|
|
||||||
|
// cause the logout - the token is not authenticated
|
||||||
return new AnonymousToken($this->providerKey, 'anon.');
|
return new AnonymousToken($this->providerKey, 'anon.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user