From f6637dd9008deb786823aba02102870e4bd26e25 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 28 Feb 2017 13:20:26 +0100 Subject: [PATCH] =?UTF-8?q?Revert=20"bug=20#21791=20[SecurityBundle]=C2=A0?= =?UTF-8?q?only=20pass=20relevant=20user=20provider=20(xabbuh)"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit eb750be851a487be333dcd866cc35c1853bc0ecd, reversing changes made to 70be4ba3caad1278a20779cc43dddaf7e36658d4. --- .../DependencyInjection/SecurityExtension.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php index 625b475b3c..36c16e0dbc 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php @@ -214,6 +214,16 @@ class SecurityExtension extends Extension $firewalls = $config['firewalls']; $providerIds = $this->createUserProviders($config, $container); + // make the ContextListener aware of the configured user providers + $definition = $container->getDefinition('security.context_listener'); + $arguments = $definition->getArguments(); + $userProviders = array(); + foreach ($providerIds as $userProviderId) { + $userProviders[] = new Reference($userProviderId); + } + $arguments[1] = $userProviders; + $definition->setArguments($arguments); + // load firewall map $mapDef = $container->getDefinition('security.firewall.map'); $map = $authenticationProviders = array(); @@ -278,7 +288,7 @@ class SecurityExtension extends Extension $contextKey = $firewall['context']; } - $listeners[] = new Reference($this->createContextListener($container, $contextKey, $defaultProvider)); + $listeners[] = new Reference($this->createContextListener($container, $contextKey)); } // Logout listener @@ -361,7 +371,7 @@ class SecurityExtension extends Extension return array($matcher, $listeners, $exceptionListener); } - private function createContextListener($container, $contextKey, $providerId) + private function createContextListener($container, $contextKey) { if (isset($this->contextListeners[$contextKey])) { return $this->contextListeners[$contextKey]; @@ -369,7 +379,6 @@ class SecurityExtension extends Extension $listenerId = 'security.context_listener.'.count($this->contextListeners); $listener = $container->setDefinition($listenerId, new DefinitionDecorator('security.context_listener')); - $listener->replaceArgument(1, array(new Reference($providerId))); $listener->replaceArgument(2, $contextKey); return $this->contextListeners[$contextKey] = $listenerId;