diff --git a/src/Maker/MakeAuthenticator.php b/src/Maker/MakeAuthenticator.php index 92cd32ec29..2d8a789705 100644 --- a/src/Maker/MakeAuthenticator.php +++ b/src/Maker/MakeAuthenticator.php @@ -43,6 +43,7 @@ use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\Security\Core\Security; +use Symfony\Component\Security\Guard\AuthenticatorInterface as GuardAuthenticatorInterface; use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; use Symfony\Component\Security\Http\Authenticator\AbstractAuthenticator; use Symfony\Component\Security\Http\Authenticator\AbstractLoginFormAuthenticator; @@ -103,7 +104,7 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma $manipulator = new YamlSourceManipulator($this->fileManager->getFileContents($path)); $securityData = $manipulator->getData(); - if (!($securityData['security']['enable_authenticator_manager'] ?? false)) { + if (interface_exists(GuardAuthenticatorInterface::class) && !($securityData['security']['enable_authenticator_manager'] ?? false)) { throw new RuntimeCommandException('MakerBundle only supports the new authenticator based security system. See https://symfony.com/doc/current/security.html'); } diff --git a/src/Maker/MakeRegistrationForm.php b/src/Maker/MakeRegistrationForm.php index 3080ac9cfc..8bfa5c04b6 100644 --- a/src/Maker/MakeRegistrationForm.php +++ b/src/Maker/MakeRegistrationForm.php @@ -49,6 +49,7 @@ use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\RouterInterface; use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Guard\AuthenticatorInterface as GuardAuthenticatorInterface; use Symfony\Component\Security\Http\Authentication\UserAuthenticatorInterface; use Symfony\Component\Translation\Translator; use Symfony\Component\Validator\Validation; @@ -124,7 +125,7 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma $providersData = $securityData['security']['providers'] ?? []; // Determine if we should use new security features introduced in Symfony 5.2 - if ($securityData['security']['enable_authenticator_manager'] ?? false) { + if (!interface_exists(GuardAuthenticatorInterface::class) || ($securityData['security']['enable_authenticator_manager'] ?? false)) { $this->useNewAuthenticatorSystem = true; }