[SecurityBundle] convert templating configuration to PHP
This commit is contained in:
parent
1b086eefb0
commit
0c36a4b8d9
@ -29,6 +29,7 @@ use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
|
||||
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
|
||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
@ -106,6 +107,9 @@ class SecurityExtension extends Extension implements PrependExtensionInterface
|
||||
|
||||
// load services
|
||||
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||
|
||||
$phpLoader = new PhpFileLoader($container, new FileLocator(\dirname(__DIR__).'/Resources/config'));
|
||||
|
||||
$loader->load('security.xml');
|
||||
$loader->load('security_listeners.xml');
|
||||
$loader->load('security_rememberme.xml');
|
||||
@ -128,7 +132,7 @@ class SecurityExtension extends Extension implements PrependExtensionInterface
|
||||
}
|
||||
|
||||
if (class_exists(AbstractExtension::class)) {
|
||||
$loader->load('templating_twig.xml');
|
||||
$phpLoader->load('templating_twig.php');
|
||||
}
|
||||
|
||||
$loader->load('collectors.xml');
|
||||
|
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
|
||||
|
||||
use Symfony\Bridge\Twig\Extension\LogoutUrlExtension;
|
||||
use Symfony\Bridge\Twig\Extension\SecurityExtension;
|
||||
|
||||
return static function (ContainerConfigurator $container) {
|
||||
$container->services()
|
||||
->set('twig.extension.logout_url', LogoutUrlExtension::class)
|
||||
->args([
|
||||
service('security.logout_url_generator'),
|
||||
])
|
||||
->tag('twig.extension')
|
||||
|
||||
->set('twig.extension.security', SecurityExtension::class)
|
||||
->args([
|
||||
service('security.authorization_checker')->ignoreOnInvalid(),
|
||||
])
|
||||
->tag('twig.extension')
|
||||
;
|
||||
};
|
@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" ?>
|
||||
|
||||
<container xmlns="http://symfony.com/schema/dic/services"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||
|
||||
<services>
|
||||
<defaults public="false" />
|
||||
|
||||
<service id="twig.extension.logout_url" class="Symfony\Bridge\Twig\Extension\LogoutUrlExtension">
|
||||
<tag name="twig.extension" />
|
||||
<argument type="service" id="security.logout_url_generator" />
|
||||
</service>
|
||||
|
||||
<service id="twig.extension.security" class="Symfony\Bridge\Twig\Extension\SecurityExtension">
|
||||
<tag name="twig.extension" />
|
||||
<argument type="service" id="security.authorization_checker" on-invalid="ignore" />
|
||||
</service>
|
||||
</services>
|
||||
</container>
|
Reference in New Issue
Block a user