Skip to content

Commit b3cf8d9

Browse files
authored
Merge pull request #66 from rudott/master
Added Symfony 4 compliant changes
2 parents c32db2e + 0bbbf36 commit b3cf8d9

2 files changed

Lines changed: 24 additions & 7 deletions

File tree

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
},
2121
"require": {
2222
"php": ">=5.5.1",
23-
"symfony/framework-bundle": "~2.3|~3.0",
24-
"symfony/security-bundle": "~2.3|~3.0",
23+
"symfony/framework-bundle": "~2.3|~3.0|~4.0",
24+
"symfony/security-bundle": "~2.3|~3.0|~4.0",
2525
"lightsaml/symfony-bridge": "~1.0"
2626
},
2727
"require-dev": {
28-
"phpunit/phpunit": "~4.6",
29-
"symfony/symfony": "~2.3|~3.0",
30-
"symfony/monolog-bundle": "~2.3|~3.0",
28+
"phpunit/phpunit": "~4.6|~5.3",
29+
"symfony/symfony": "~2.3|~3.0|~4.0",
30+
"symfony/monolog-bundle": "~2.3|~3.0|~4.0",
3131
"satooshi/php-coveralls": "~0.6"
3232
},
3333
"config": {

src/LightSaml/SpBundle/DependencyInjection/Security/Factory/LightSamlSpFactory.php

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AbstractFactory;
1515
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
16+
use Symfony\Component\DependencyInjection\ChildDefinition;
1617
use Symfony\Component\DependencyInjection\ContainerBuilder;
1718
use Symfony\Component\DependencyInjection\DefinitionDecorator;
1819
use Symfony\Component\DependencyInjection\Reference;
@@ -46,9 +47,17 @@ public function addConfiguration(NodeDefinition $node)
4647
*/
4748
protected function createAuthProvider(ContainerBuilder $container, $id, $config, $userProviderId)
4849
{
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+
4958
$providerId = 'security.authentication.provider.lightsaml_sp.'.$id;
5059
$provider = $container
51-
->setDefinition($providerId, new DefinitionDecorator('security.authentication.provider.lightsaml_sp'))
60+
->setDefinition($providerId, $definition)
5261
->replaceArgument(0, $id)
5362
->replaceArgument(2, $config['force'])
5463
;
@@ -111,8 +120,16 @@ protected function createEntryPoint($container, $id, $config, $defaultEntryPoint
111120
{
112121
$entryPointId = 'security.authentication.form_entry_point.'.$id;
113122

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+
114131
$container
115-
->setDefinition($entryPointId, new DefinitionDecorator('security.authentication.form_entry_point'))
132+
->setDefinition($entryPointId, $definition)
116133
->addArgument(new Reference('security.http_utils'))
117134
->addArgument($config['login_path'])
118135
->addArgument($config['use_forward'])

0 commit comments

Comments
 (0)