forked from markitosgv/JWTRefreshTokenBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GesdinetJWTRefreshTokenBundle.php
33 lines (28 loc) · 1.56 KB
/
GesdinetJWTRefreshTokenBundle.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
<?php
namespace Gesdinet\JWTRefreshTokenBundle;
use Gesdinet\JWTRefreshTokenBundle\DependencyInjection\Compiler\AddExtractorsToChainCompilerPass;
use Gesdinet\JWTRefreshTokenBundle\DependencyInjection\Compiler\CustomUserProviderCompilerPass;
use Gesdinet\JWTRefreshTokenBundle\DependencyInjection\Compiler\ObjectManagerCompilerPass;
use Gesdinet\JWTRefreshTokenBundle\DependencyInjection\Compiler\UserCheckerCompilerPass;
use Gesdinet\JWTRefreshTokenBundle\DependencyInjection\Security\Factory\RefreshTokenAuthenticatorFactory;
use Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\Security\Http\RememberMe\RememberMeHandlerInterface;
class GesdinetJWTRefreshTokenBundle extends Bundle
{
public function build(ContainerBuilder $container): void
{
parent::build($container);
$container->addCompilerPass(new AddExtractorsToChainCompilerPass());
$container->addCompilerPass(new CustomUserProviderCompilerPass(true));
$container->addCompilerPass(new ObjectManagerCompilerPass());
$container->addCompilerPass(new UserCheckerCompilerPass(true));
// Only register the security authenticator for Symfony 5.4+
if (interface_exists(RememberMeHandlerInterface::class)) {
/** @var SecurityExtension $extension */
$extension = $container->getExtension('security');
$extension->addAuthenticatorFactory(new RefreshTokenAuthenticatorFactory());
}
}
}