Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f6637dd

Browse files
committed
Revert "bug #21791 [SecurityBundle] only pass relevant user provider (xabbuh)"
This reverts commit eb750be, reversing changes made to 70be4ba.
1 parent eb750be commit f6637dd

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,16 @@ private function createFirewalls($config, ContainerBuilder $container)
214214
$firewalls = $config['firewalls'];
215215
$providerIds = $this->createUserProviders($config, $container);
216216

217+
// make the ContextListener aware of the configured user providers
218+
$definition = $container->getDefinition('security.context_listener');
219+
$arguments = $definition->getArguments();
220+
$userProviders = array();
221+
foreach ($providerIds as $userProviderId) {
222+
$userProviders[] = new Reference($userProviderId);
223+
}
224+
$arguments[1] = $userProviders;
225+
$definition->setArguments($arguments);
226+
217227
// load firewall map
218228
$mapDef = $container->getDefinition('security.firewall.map');
219229
$map = $authenticationProviders = array();
@@ -278,7 +288,7 @@ private function createFirewall(ContainerBuilder $container, $id, $firewall, &$a
278288
$contextKey = $firewall['context'];
279289
}
280290

281-
$listeners[] = new Reference($this->createContextListener($container, $contextKey, $defaultProvider));
291+
$listeners[] = new Reference($this->createContextListener($container, $contextKey));
282292
}
283293

284294
// Logout listener
@@ -361,15 +371,14 @@ private function createFirewall(ContainerBuilder $container, $id, $firewall, &$a
361371
return array($matcher, $listeners, $exceptionListener);
362372
}
363373

364-
private function createContextListener($container, $contextKey, $providerId)
374+
private function createContextListener($container, $contextKey)
365375
{
366376
if (isset($this->contextListeners[$contextKey])) {
367377
return $this->contextListeners[$contextKey];
368378
}
369379

370380
$listenerId = 'security.context_listener.'.count($this->contextListeners);
371381
$listener = $container->setDefinition($listenerId, new DefinitionDecorator('security.context_listener'));
372-
$listener->replaceArgument(1, array(new Reference($providerId)));
373382
$listener->replaceArgument(2, $contextKey);
374383

375384
return $this->contextListeners[$contextKey] = $listenerId;

0 commit comments

Comments
 (0)