Skip to content

[SecurityBundle] Move configuration from XML to PHP #37238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ public function load(array $configs, ContainerBuilder $container)
$phpLoader->load('templating_twig.php');
}

$loader->load('collectors.xml');
$loader->load('guard.xml');
$phpLoader->load('collectors.php');
$phpLoader->load('guard.php');

if ($container->hasParameter('kernel.debug') && $container->getParameter('kernel.debug')) {
$loader->load('security_debug.xml');
Expand Down Expand Up @@ -177,7 +177,7 @@ public function load(array $configs, ContainerBuilder $container)
}

if (class_exists(Application::class)) {
$loader->load('console.xml');
$phpLoader->load('console.php');
$container->getDefinition('security.command.user_password_encoder')->replaceArgument(1, array_keys($config['encoders']));
}

Expand Down
33 changes: 33 additions & 0 deletions src/Symfony/Bundle/SecurityBundle/Resources/config/collectors.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?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\Bundle\SecurityBundle\DataCollector\SecurityDataCollector;

return static function (ContainerConfigurator $container) {
$container->services()
->set('data_collector.security', SecurityDataCollector::class)
->args([
service('security.untracked_token_storage'),
service('security.role_hierarchy'),
service('security.logout_url_generator'),
service('security.access.decision_manager'),
service('security.firewall.map'),
service('debug.security.firewall')->nullOnInvalid(),
])
->tag('data_collector', [
'template' => '@Security/Collector/security.html.twig',
'id' => 'security',
'priority' => 270,
])
;
};
20 changes: 0 additions & 20 deletions src/Symfony/Bundle/SecurityBundle/Resources/config/collectors.xml

This file was deleted.

25 changes: 25 additions & 0 deletions src/Symfony/Bundle/SecurityBundle/Resources/config/console.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?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\Bundle\SecurityBundle\Command\UserPasswordEncoderCommand;

return static function (ContainerConfigurator $container) {
$container->services()
->set('security.command.user_password_encoder', UserPasswordEncoderCommand::class)
->args([
service('security.encoder_factory'),
abstract_arg('encoders user classes'),
])
->tag('console.command', ['command' => 'security:encode-password'])
;
};
16 changes: 0 additions & 16 deletions src/Symfony/Bundle/SecurityBundle/Resources/config/console.xml

This file was deleted.

51 changes: 51 additions & 0 deletions src/Symfony/Bundle/SecurityBundle/Resources/config/guard.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?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\Component\Security\Guard\Firewall\GuardAuthenticationListener;
use Symfony\Component\Security\Guard\GuardAuthenticatorHandler;
use Symfony\Component\Security\Guard\Provider\GuardAuthenticationProvider;

return static function (ContainerConfigurator $container) {
$container->services()
->set('security.authentication.guard_handler', GuardAuthenticatorHandler::class)
->args([
service('security.token_storage'),
service('event_dispatcher')->nullOnInvalid(),
abstract_arg('stateless firewall keys'),
])
->call('setSessionAuthenticationStrategy', [service('security.authentication.session_strategy')])

->alias(GuardAuthenticatorHandler::class, 'security.authentication.guard_handler')

->set('security.authentication.provider.guard', GuardAuthenticationProvider::class)
->abstract()
->args([
abstract_arg('Authenticators'),
abstract_arg('User Provider'),
abstract_arg('Provider-shared Key'),
abstract_arg('User Checker'),
service('security.password_encoder'),
])

->set('security.authentication.listener.guard', GuardAuthenticationListener::class)
->abstract()
->args([
service('security.authentication.guard_handler'),
service('security.authentication.manager'),
abstract_arg('Provider-shared Key'),
abstract_arg('Authenticators'),
service('logger')->nullOnInvalid(),
])
->tag('monolog.logger', ['channel' => 'security'])
;
};
47 changes: 0 additions & 47 deletions src/Symfony/Bundle/SecurityBundle/Resources/config/guard.xml

This file was deleted.

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy