From 8d60c6a8025e142b2d573e920c62ed5b0e6e4831 Mon Sep 17 00:00:00 2001 From: Antoine Makdessi Date: Thu, 14 Mar 2024 15:02:54 +0100 Subject: [PATCH] fix(security): user programatic login with dedicated user checker on firewall --- src/Symfony/Bundle/SecurityBundle/Security.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/SecurityBundle/Security.php b/src/Symfony/Bundle/SecurityBundle/Security.php index c4b505d8981c7..60520a75e449e 100644 --- a/src/Symfony/Bundle/SecurityBundle/Security.php +++ b/src/Symfony/Bundle/SecurityBundle/Security.php @@ -96,7 +96,12 @@ public function login(UserInterface $user, ?string $authenticatorName = null, ?s $authenticator = $this->getAuthenticator($authenticatorName, $firewallName); - $this->container->get('security.user_checker')->checkPreAuth($user); + + if ($this->container->has('security.user_checker.'$firewallName)) { + $this->container->get('security.user_checker.'$firewallName)->checkPreAuth($user); + } else { + $this->container->get('security.user_checker')->checkPreAuth($user); + } return $this->container->get('security.authenticator.managers_locator')->get($firewallName)->authenticateUser($user, $authenticator, $request, $badges); }