$request =
$this->container->
get('request_stack'
)->
getCurrentRequest();
$firewallName ??=
$this->
getFirewallConfig($request)?->
getName();
if (!
$firewallName) { throw new LogicException('Unable to login as the current route is not covered by any firewall.'
);
} $authenticator =
$this->
getAuthenticator($authenticatorName,
$firewallName);
$this->container->
get('security.user_checker'
)->
checkPreAuth($user);
return $this->container->
get('security.authenticator.managers_locator'
)->
get($firewallName)->
authenticateUser($user,
$authenticator,
$request,
$badges);
} /**
* Logout the current user by dispatching the LogoutEvent.
*
* @param bool $validateCsrfToken Whether to look for a valid CSRF token based on the `logout` listener configuration
*
* @return Response|null The LogoutEvent's Response if any
*
* @throws LogoutException When $validateCsrfToken is true and the CSRF token is not found or invalid
*/