forked from lexik/LexikJWTAuthenticationBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LexikJWTAuthenticationBundle.php
43 lines (36 loc) · 1.29 KB
/
LexikJWTAuthenticationBundle.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
37
38
39
40
41
42
43
<?php
namespace Lexik\Bundle\JWTAuthenticationBundle;
use Lexik\Bundle\JWTAuthenticationBundle\DependencyInjection\Compiler\WireGenerateTokenCommandPass;
use Lexik\Bundle\JWTAuthenticationBundle\DependencyInjection\Security\Factory\JWTFactory;
use Lexik\Bundle\JWTAuthenticationBundle\DependencyInjection\Security\Factory\JWTUserFactory;
use Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension;
use Symfony\Component\Console\Application;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* LexikJWTAuthenticationBundle.
*
* @author Nicolas Cabot <[email protected]>
*/
class LexikJWTAuthenticationBundle extends Bundle
{
/**
* {@inheritdoc}
*/
public function build(ContainerBuilder $container)
{
parent::build($container);
$container->addCompilerPass(new WireGenerateTokenCommandPass());
/** @var SecurityExtension $extension */
$extension = $container->getExtension('security');
$extension->addUserProviderFactory(new JWTUserFactory());
$extension->addSecurityListenerFactory(new JWTFactory()); // BC 1.x, to be removed in 3.0
}
/**
* {@inheritdoc}
*/
public function registerCommands(Application $application)
{
// noop
}
}