|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the GesdinetJWTRefreshTokenBundle package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Gesdinet <http://www.gesdinet.com/> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Gesdinet\JWTRefreshTokenBundle\DependencyInjection; |
|
13
|
|
|
|
|
14
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
15
|
|
|
use Symfony\Component\Config\FileLocator; |
|
16
|
|
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension; |
|
17
|
|
|
use Symfony\Component\DependencyInjection\Loader; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* This is the class that loads and manages your bundle configuration. |
|
21
|
|
|
* |
|
22
|
|
|
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html} |
|
23
|
|
|
*/ |
|
24
|
|
|
class GesdinetJWTRefreshTokenExtension extends Extension |
|
25
|
|
|
{ |
|
26
|
|
|
/** |
|
27
|
|
|
* {@inheritdoc} |
|
28
|
|
|
*/ |
|
29
|
1 |
|
public function load(array $configs, ContainerBuilder $container) |
|
30
|
|
|
{ |
|
31
|
1 |
|
$configuration = new Configuration(); |
|
32
|
1 |
|
$config = $this->processConfiguration($configuration, $configs); |
|
33
|
|
|
|
|
34
|
1 |
|
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
35
|
1 |
|
$loader->load('services.yml'); |
|
36
|
|
|
|
|
37
|
1 |
|
$container->setParameter('gesdinet_jwt_refresh_token.ttl', $config['ttl']); |
|
38
|
1 |
|
$container->setParameter('gesdinet_jwt_refresh_token.ttl_update', $config['ttl_update']); |
|
39
|
1 |
|
$container->setParameter('gesdinet_jwt_refresh_token.security.firewall', $config['firewall']); |
|
40
|
1 |
|
$container->setParameter('gesdinet_jwt_refresh_token.user_provider', $config['user_provider']); |
|
41
|
|
|
|
|
42
|
|
|
//if refresh_token_entity has not be defined in config, we don't want to erase base value |
|
43
|
1 |
|
if (isset($config['refresh_token_entity'])) { |
|
44
|
|
|
$container->setParameter('gesdinet.jwtrefreshtoken.refresh_token.class', $config['refresh_token_entity']); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
1 |
|
$container->setParameter('gesdinet.jwtrefreshtoken.entity_manager.id', $config['entity_manager']); |
|
48
|
1 |
|
} |
|
49
|
|
|
} |
|
50
|
|
|
|