Skip to content

Commit

Permalink
Merge pull request #66 from rudott/master
Browse files Browse the repository at this point in the history
Added Symfony 4 compliant changes
  • Loading branch information
tmilos committed Mar 20, 2018
2 parents c32db2e + 0bbbf36 commit b3cf8d9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
},
"require": {
"php": ">=5.5.1",
"symfony/framework-bundle": "~2.3|~3.0",
"symfony/security-bundle": "~2.3|~3.0",
"symfony/framework-bundle": "~2.3|~3.0|~4.0",
"symfony/security-bundle": "~2.3|~3.0|~4.0",
"lightsaml/symfony-bridge": "~1.0"
},
"require-dev": {
"phpunit/phpunit": "~4.6",
"symfony/symfony": "~2.3|~3.0",
"symfony/monolog-bundle": "~2.3|~3.0",
"phpunit/phpunit": "~4.6|~5.3",
"symfony/symfony": "~2.3|~3.0|~4.0",
"symfony/monolog-bundle": "~2.3|~3.0|~4.0",
"satooshi/php-coveralls": "~0.6"
},
"config": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AbstractFactory;
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\DefinitionDecorator;
use Symfony\Component\DependencyInjection\Reference;
Expand Down Expand Up @@ -46,9 +47,17 @@ public function addConfiguration(NodeDefinition $node)
*/
protected function createAuthProvider(ContainerBuilder $container, $id, $config, $userProviderId)
{
if (class_exists('Symfony\Component\DependencyInjection\ChildDefinition')) {
// Symfony >= 3.3
$definition = new ChildDefinition('security.authentication.provider.lightsaml_sp');
} else {
// Symfony < 3.3
$definition = new DefinitionDecorator('security.authentication.provider.lightsaml_sp');
}

$providerId = 'security.authentication.provider.lightsaml_sp.'.$id;
$provider = $container
->setDefinition($providerId, new DefinitionDecorator('security.authentication.provider.lightsaml_sp'))
->setDefinition($providerId, $definition)
->replaceArgument(0, $id)
->replaceArgument(2, $config['force'])
;
Expand Down Expand Up @@ -111,8 +120,16 @@ protected function createEntryPoint($container, $id, $config, $defaultEntryPoint
{
$entryPointId = 'security.authentication.form_entry_point.'.$id;

if (class_exists('Symfony\Component\DependencyInjection\ChildDefinition')) {
// Symfony >= 3.3
$definition = new ChildDefinition('security.authentication.form_entry_point');
} else {
// Symfony < 3.3
$definition = new DefinitionDecorator('security.authentication.form_entry_point');
}

$container
->setDefinition($entryPointId, new DefinitionDecorator('security.authentication.form_entry_point'))
->setDefinition($entryPointId, $definition)
->addArgument(new Reference('security.http_utils'))
->addArgument($config['login_path'])
->addArgument($config['use_forward'])
Expand Down

0 comments on commit b3cf8d9

Please sign in to comment.