This PR was merged into the 2.7 branch.
Discussion
----------
Revert "bug #21791 [SecurityBundle] only pass relevant user provider (xabbuh)"
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21791
| License | MIT
| Doc PR |
#21791 was a mistake as pointed out by @slaci (see https://github.com/symfony/symfony/pull/21791#issuecomment-282990746) and @stof (see https://github.com/symfony/symfony/pull/21792#issuecomment-282980046).
Commits
-------
f6637dd
Revert "bug #21791 [SecurityBundle] only pass relevant user provider (xabbuh)"
This commit is contained in:
commit
9aebfad501
@ -214,6 +214,16 @@ class SecurityExtension extends Extension
|
|||||||
$firewalls = $config['firewalls'];
|
$firewalls = $config['firewalls'];
|
||||||
$providerIds = $this->createUserProviders($config, $container);
|
$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
|
// load firewall map
|
||||||
$mapDef = $container->getDefinition('security.firewall.map');
|
$mapDef = $container->getDefinition('security.firewall.map');
|
||||||
$map = $authenticationProviders = array();
|
$map = $authenticationProviders = array();
|
||||||
@ -278,7 +288,7 @@ class SecurityExtension extends Extension
|
|||||||
$contextKey = $firewall['context'];
|
$contextKey = $firewall['context'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$listeners[] = new Reference($this->createContextListener($container, $contextKey, $defaultProvider));
|
$listeners[] = new Reference($this->createContextListener($container, $contextKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logout listener
|
// Logout listener
|
||||||
@ -361,7 +371,7 @@ class SecurityExtension extends Extension
|
|||||||
return array($matcher, $listeners, $exceptionListener);
|
return array($matcher, $listeners, $exceptionListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createContextListener($container, $contextKey, $providerId)
|
private function createContextListener($container, $contextKey)
|
||||||
{
|
{
|
||||||
if (isset($this->contextListeners[$contextKey])) {
|
if (isset($this->contextListeners[$contextKey])) {
|
||||||
return $this->contextListeners[$contextKey];
|
return $this->contextListeners[$contextKey];
|
||||||
@ -369,7 +379,6 @@ class SecurityExtension extends Extension
|
|||||||
|
|
||||||
$listenerId = 'security.context_listener.'.count($this->contextListeners);
|
$listenerId = 'security.context_listener.'.count($this->contextListeners);
|
||||||
$listener = $container->setDefinition($listenerId, new DefinitionDecorator('security.context_listener'));
|
$listener = $container->setDefinition($listenerId, new DefinitionDecorator('security.context_listener'));
|
||||||
$listener->replaceArgument(1, array(new Reference($providerId)));
|
|
||||||
$listener->replaceArgument(2, $contextKey);
|
$listener->replaceArgument(2, $contextKey);
|
||||||
|
|
||||||
return $this->contextListeners[$contextKey] = $listenerId;
|
return $this->contextListeners[$contextKey] = $listenerId;
|
||||||
|
Reference in New Issue
Block a user