Elcodi\Admin\UserBundle\Security\OneTimeLoginAuthenticator::createToken PHP Method

createToken() public method

Creates a token with the login key received on the query parameter.
public createToken ( Request $request, string $providerKey ) : PreAuthenticatedToken
$request Symfony\Component\HttpFoundation\Request The current request.
$providerKey string The security providerKey (The firewall security area)
return Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken A pre-authenticated token with the login key received.
    public function createToken(Request $request, $providerKey)
    {
        $loginKey = $request->query->get('login-key');
        if (!$loginKey) {
            throw new BadCredentialsException('No login key found');
        }
        return new PreAuthenticatedToken('anon.', $loginKey, $providerKey);
    }