-
Notifications
You must be signed in to change notification settings - Fork 5
/
SchebTwoFactorBundle.php
36 lines (29 loc) · 1.31 KB
/
SchebTwoFactorBundle.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
declare(strict_types=1);
namespace Scheb\TwoFactorBundle;
use Scheb\TwoFactorBundle\DependencyInjection\Compiler\MailerCompilerPass;
use Scheb\TwoFactorBundle\DependencyInjection\Compiler\TwoFactorFirewallConfigCompilerPass;
use Scheb\TwoFactorBundle\DependencyInjection\Compiler\TwoFactorProviderCompilerPass;
use Scheb\TwoFactorBundle\DependencyInjection\Factory\Security\TwoFactorFactory;
use Scheb\TwoFactorBundle\DependencyInjection\Factory\Security\TwoFactorServicesFactory;
use Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use function assert;
/**
* @final
*/
class SchebTwoFactorBundle extends Bundle
{
public function build(ContainerBuilder $container): void
{
parent::build($container);
$container->addCompilerPass(new TwoFactorProviderCompilerPass());
$container->addCompilerPass(new TwoFactorFirewallConfigCompilerPass());
$container->addCompilerPass(new MailerCompilerPass());
$extension = $container->getExtension('security');
assert($extension instanceof SecurityExtension);
$securityFactory = new TwoFactorFactory(new TwoFactorServicesFactory());
$extension->addAuthenticatorFactory($securityFactory);
}
}