Skip to content

Commit 26925d1

Browse files
committed
[SecurityBundle] Keep authenticators’ service original ID as their name
1 parent 89cd804 commit 26925d1

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

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

+6-7
Original file line numberDiff line numberDiff line change
@@ -312,11 +312,10 @@ private function createFirewalls(array $config, ContainerBuilder $container): vo
312312
if (!$firewallAuthenticators) {
313313
$authenticators[$name] = null;
314314
} else {
315-
$firewallAuthenticatorRefs = [];
316-
foreach ($firewallAuthenticators as $authenticatorId) {
317-
$firewallAuthenticatorRefs[$authenticatorId] = new Reference($authenticatorId);
318-
}
319-
$authenticators[$name] = ServiceLocatorTagPass::register($container, $firewallAuthenticatorRefs);
315+
$authenticators[$name] = ServiceLocatorTagPass::register($container, array_map(
316+
static fn (string $authenticatorId) => new Reference($authenticatorId),
317+
$firewallAuthenticators
318+
));
320319
}
321320
$contextId = 'security.firewall.map.context.'.$name;
322321
$isLazy = !$firewall['stateless'] && (!empty($firewall['anonymous']['lazy']) || $firewall['lazy']);
@@ -625,11 +624,11 @@ private function createAuthenticationListeners(ContainerBuilder $container, stri
625624
$authenticators = $factory->createAuthenticator($container, $id, $firewall[$key], $userProvider);
626625
if (\is_array($authenticators)) {
627626
foreach ($authenticators as $authenticator) {
628-
$authenticationProviders[] = $authenticator;
627+
$authenticationProviders[$authenticator] = $authenticator;
629628
$entryPoints[] = $authenticator;
630629
}
631630
} else {
632-
$authenticationProviders[] = $authenticators;
631+
$authenticationProviders[$authenticators] = $authenticators;
633632
$entryPoints[$key] = $authenticators;
634633
}
635634

0 commit comments

Comments
 (0)