1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Norsys\SecurityBundle\DependencyInjection; |
4
|
|
|
|
5
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
6
|
|
|
use Symfony\Component\Config\FileLocator; |
7
|
|
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension; |
8
|
|
|
use Symfony\Component\DependencyInjection\Loader; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* This is the class that loads and manages your bundle configuration. |
12
|
|
|
* |
13
|
|
|
* @link http://symfony.com/doc/current/cookbook/bundles/extension.html |
14
|
|
|
*/ |
15
|
|
|
class NorsysSecurityExtension extends Extension |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* @param array $configs |
19
|
|
|
* @param ContainerBuilder $container |
20
|
|
|
*/ |
21
|
|
|
public function load(array $configs, ContainerBuilder $container) |
22
|
|
|
{ |
23
|
|
|
$configuration = new Configuration(); |
24
|
|
|
$config = $this->processConfiguration($configuration, $configs); |
25
|
|
|
|
26
|
|
|
$container->setParameter('norsys_security.coming_soon.enabled', $config['coming_soon']['enabled']); |
27
|
|
|
$container->setParameter('norsys_security.coming_soon.allowed_ips', $config['coming_soon']['allowed_ips']); |
28
|
|
|
$container->setParameter('norsys_security.coming_soon.template', $config['coming_soon']['template']); |
29
|
|
|
$container->setParameter('norsys_security.https_redirect.enabled', $config['https_redirect']['enabled']); |
30
|
|
|
$container->setParameter('norsys_security.proxy.enabled', $config['proxy']['enabled']); |
31
|
|
|
$container->setParameter('norsys_security.proxy.env_variable_name', $config['proxy']['env_variable_name']); |
32
|
|
|
$container->setParameter('norsys_security.proxy.trusted_header_set', $config['proxy']['trusted_header_set']); |
33
|
|
|
$container->setParameter( |
34
|
|
|
'norsys_security.proxy.env_variable_separator', |
35
|
|
|
$config['proxy']['env_variable_separator'] |
36
|
|
|
); |
37
|
|
|
|
38
|
|
|
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
39
|
|
|
$loader->load('services.yml'); |
40
|
|
|
} |
41
|
|
|
} |
42
|
|
|
|