Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Security] deprecate multiple providers in context listener #21792

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[SecurityBundle] only pass relevant user provider
  • Loading branch information
xabbuh committed Feb 27, 2017
commit fbd9f88e312d03614b7e96ed3a1c8c993eb8c0b5
Original file line number Diff line number Diff line change
Expand Up @@ -234,16 +234,6 @@ private function createFirewalls($config, ContainerBuilder $container)
$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 = $contextRefs = array();
Expand Down Expand Up @@ -327,7 +317,7 @@ private function createFirewall(ContainerBuilder $container, $id, $firewall, &$a
$contextKey = $firewall['context'];
}

$listeners[] = new Reference($this->createContextListener($container, $contextKey));
$listeners[] = new Reference($this->createContextListener($container, $contextKey, $defaultProvider));
}

$config->replaceArgument(6, $contextKey);
Expand Down Expand Up @@ -436,14 +426,15 @@ private function createFirewall(ContainerBuilder $container, $id, $firewall, &$a
return array($matcher, $listeners, $exceptionListener);
}

private function createContextListener($container, $contextKey)
private function createContextListener($container, $contextKey, $providerId)
{
if (isset($this->contextListeners[$contextKey])) {
return $this->contextListeners[$contextKey];
}

$listenerId = 'security.context_listener.'.count($this->contextListeners);
$listener = $container->setDefinition($listenerId, new ChildDefinition('security.context_listener'));
$listener->replaceArgument(1, array(new Reference($providerId)));
$listener->replaceArgument(2, $contextKey);

return $this->contextListeners[$contextKey] = $listenerId;
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.