throw new \
LogicException(sprintf('"%s" requires symfony/security-core to be installed. Try running "composer require symfony/security-core".', __METHOD__
));
} if (!
$user instanceof UserInterface
) { throw new \
LogicException(sprintf('The first argument of "%s" must be instance of "%s", "%s" provided.', __METHOD__, UserInterface::
class,
get_debug_type($user)));
} $token =
new TestBrowserToken($user->
getRoles(),
$user,
$firewallContext);
$token->
setAttributes($tokenAttributes);
// required for compatibility with Symfony 5.4
if (method_exists($token, 'isAuthenticated'
)) { $token->
setAuthenticated(true, false
);
} $container =
$this->
getContainer();
$container->
get('security.untracked_token_storage'
)->
setToken($token);
if (!
$container->
has('session.factory'
)) { return $this;
} $session =
$container->
get('session.factory'
)->
createSession();
$session->
set('_security_'.
$firewallContext,
serialize($token));