|
13 | 13 |
|
14 | 14 | use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AbstractFactory; |
15 | 15 | use Symfony\Component\Config\Definition\Builder\NodeDefinition; |
| 16 | +use Symfony\Component\DependencyInjection\ChildDefinition; |
16 | 17 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
17 | 18 | use Symfony\Component\DependencyInjection\DefinitionDecorator; |
18 | 19 | use Symfony\Component\DependencyInjection\Reference; |
@@ -46,9 +47,17 @@ public function addConfiguration(NodeDefinition $node) |
46 | 47 | */ |
47 | 48 | protected function createAuthProvider(ContainerBuilder $container, $id, $config, $userProviderId) |
48 | 49 | { |
| 50 | + if (class_exists('Symfony\Component\DependencyInjection\ChildDefinition')) { |
| 51 | + // Symfony >= 3.3 |
| 52 | + $definition = new ChildDefinition('security.authentication.provider.lightsaml_sp'); |
| 53 | + } else { |
| 54 | + // Symfony < 3.3 |
| 55 | + $definition = new DefinitionDecorator('security.authentication.provider.lightsaml_sp'); |
| 56 | + } |
| 57 | + |
49 | 58 | $providerId = 'security.authentication.provider.lightsaml_sp.'.$id; |
50 | 59 | $provider = $container |
51 | | - ->setDefinition($providerId, new DefinitionDecorator('security.authentication.provider.lightsaml_sp')) |
| 60 | + ->setDefinition($providerId, $definition) |
52 | 61 | ->replaceArgument(0, $id) |
53 | 62 | ->replaceArgument(2, $config['force']) |
54 | 63 | ; |
@@ -111,8 +120,16 @@ protected function createEntryPoint($container, $id, $config, $defaultEntryPoint |
111 | 120 | { |
112 | 121 | $entryPointId = 'security.authentication.form_entry_point.'.$id; |
113 | 122 |
|
| 123 | + if (class_exists('Symfony\Component\DependencyInjection\ChildDefinition')) { |
| 124 | + // Symfony >= 3.3 |
| 125 | + $definition = new ChildDefinition('security.authentication.form_entry_point'); |
| 126 | + } else { |
| 127 | + // Symfony < 3.3 |
| 128 | + $definition = new DefinitionDecorator('security.authentication.form_entry_point'); |
| 129 | + } |
| 130 | + |
114 | 131 | $container |
115 | | - ->setDefinition($entryPointId, new DefinitionDecorator('security.authentication.form_entry_point')) |
| 132 | + ->setDefinition($entryPointId, $definition) |
116 | 133 | ->addArgument(new Reference('security.http_utils')) |
117 | 134 | ->addArgument($config['login_path']) |
118 | 135 | ->addArgument($config['use_forward']) |
|
0 commit comments