vendor/scheb/2fa-bundle/SchebTwoFactorBundle.php line 20

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Scheb\TwoFactorBundle;
  4. use Scheb\TwoFactorBundle\DependencyInjection\Compiler\MailerCompilerPass;
  5. use Scheb\TwoFactorBundle\DependencyInjection\Compiler\TwoFactorFirewallConfigCompilerPass;
  6. use Scheb\TwoFactorBundle\DependencyInjection\Compiler\TwoFactorProviderCompilerPass;
  7. use Scheb\TwoFactorBundle\DependencyInjection\Factory\Security\TwoFactorFactory;
  8. use Scheb\TwoFactorBundle\DependencyInjection\Factory\Security\TwoFactorServicesFactory;
  9. use Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension;
  10. use Symfony\Component\DependencyInjection\ContainerBuilder;
  11. use Symfony\Component\HttpKernel\Bundle\Bundle;
  12. use function assert;
  13. /**
  14.  * @final
  15.  */
  16. class SchebTwoFactorBundle extends Bundle
  17. {
  18.     public function build(ContainerBuilder $container): void
  19.     {
  20.         parent::build($container);
  21.         $container->addCompilerPass(new TwoFactorProviderCompilerPass());
  22.         $container->addCompilerPass(new TwoFactorFirewallConfigCompilerPass());
  23.         $container->addCompilerPass(new MailerCompilerPass());
  24.         $extension $container->getExtension('security');
  25.         assert($extension instanceof SecurityExtension);
  26.         $securityFactory = new TwoFactorFactory(new TwoFactorServicesFactory());
  27.         $extension->addAuthenticatorFactory($securityFactory);
  28.     }
  29. }