I have a TokenAuthenticator
which implements SimplePreAuthenticatorInterface
, AuthenticationSuccessHandlerInterface
and AuthenticationFailureHandlerInterface
. It creates a PreAuthenticatedToken
token.
Within that class I have a method called authenticateToken
which looks like this.
/**
* @param TokenInterface $token
* @param UserProviderInterface $userProvider
* @param $providerKey
*
* @return PreAuthenticatedToken
*/
public function authenticateToken(TokenInterface $token, UserProviderInterface $userProvider, $providerKey)
{
$token = $token->getCredentials();
The code works, however there have been a couple of occasions recently where getCredentials
has returned null
causing the code to fall over.
I am trying to ascertain why this is and have considered users using private browser sessions and/or clearing their session cookies/cache etc, but I cannot seem to replicate this.
Considering the authenticateToken
method type-hints the $token
variable to a TokenInterface
- what would cause a call to getCredentials
to then return null
?