8000 [Security] Move configuration of guard to PHP · symfony/symfony@7691de4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7691de4

Browse files
JudicaelJudicael RUFFIEUX
Judicael
authored and
Judicael RUFFIEUX
committed
[Security] Move configuration of guard to PHP
1 parent 8fd3d77 commit 7691de4

File tree

3 files changed

+52
-48
lines changed

3 files changed

+52
-48
lines changed

src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public function load(array $configs, ContainerBuilder $container)
136136
}
137137

138138
$phpLoader->load('collectors.php');
139-
$loader->load('guard.xml');
139+
$phpLoader->load('guard.php');
140140

141141
if ($container->hasParameter('kernel.debug') && $container->getParameter('kernel.debug')) {
142142
$loader->load('security_debug.xml');
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
13+
14+
use Symfony\Component\Security\Guard\Provider\GuardAuthenticationProvider;
15+
use Symfony\Component\Security\Guard\Firewall\GuardAuthenticationListener;
16+
use Symfony\Component\Security\Guard\GuardAuthenticatorHandler;
17+
18+
return static function (ContainerConfigurator $container) {
19+
$container->services()
20+
->set('security.authentication.guard_handler', GuardAuthenticatorHandler::class)
21+
->call('setSessionAuthenticationStrategy', [service('security.authentication.session_strategy')])
22+
->args([
23+
service('security.token_storage'),
24+
service('event_dispatcher')->nullOnInvalid(),
25+
abstract_arg('stateless firewall keys'),
26+
])
27+
28+
->alias('Symfony\Component\Security\Guard\GuardAuthenticatorHandler', 'security.authentication.guard_handler')
29+
30+
->set('security.authentication.provider.guard', GuardAuthenticationProvider::class)
31+
->abstract()
32+
->args([
33+
abstract_arg('Simple Authenticator'),
34+
abstract_arg('User Provider'),
35+
8000 abstract_arg('Provider-shared Key'),
36+
abstract_arg('User Checker'),
37+
service('security.password_encoder'),
38+
])
39+
40+
->set('security.authentication.listener.guard', GuardAuthenticationListener::class)
41+
->abstract()
42+
->args([
43+
service('security.authentication.guard_handler'),
44+
service('security.authentication.manager'),
45+
abstract_arg('Provider-shared Key'),
46+
abstract_arg('Authenticator'),
47+
service('logger')->nullOnInvalid(),
48+
])
49+
->tag('monolog.logger', ['channel' => 'security'])
50+
;
51+
};

src/Symfony/Bundle/SecurityBundle/Resources/config/guard.xml

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)
0