Permalink
Browse files

[Security] fix DI for SimpleFormAuthenticationListener

  • Loading branch information...
Tobion committed Jan 21, 2014
1 parent 783a45d commit b3f5fa9b73545ca3d63fce419eb7a6b33522606b
@@ -75,12 +75,10 @@ protected function createListener($container, $id, $config, $userProvider)
{
$listenerId = parent::createListener($container, $id, $config, $userProvider);
if (isset($config['csrf_provider'])) {
$container
->getDefinition($listenerId)
->addArgument(new Reference($config['csrf_provider']))
;
}
$container
->getDefinition($listenerId)
->addArgument(isset($config['csrf_provider']) ? new Reference($config['csrf_provider']) : null)
;
return $listenerId;
}
@@ -63,18 +63,14 @@ protected function createAuthProvider(ContainerBuilder $container, $id, $config,
protected function createListener($container, $id, $config, $userProvider)
{
$listenerId = parent::createListener($container, $id, $config, $userProvider);
$listener = $container->getDefinition($listenerId);
if (!isset($config['csrf_token_generator'])) {
$listener->addArgument(null);
}
$simpleAuthHandlerId = 'security.authentication.simple_success_failure_handler.'.$id;
$simpleAuthHandler = $container->setDefinition($simpleAuthHandlerId, new DefinitionDecorator('security.authentication.simple_success_failure_handler'));
$simpleAuthHandler->replaceArgument(0, new Reference($config['authenticator']));
$simpleAuthHandler->replaceArgument(1, new Reference($this->getSuccessHandlerId($id)));
$simpleAuthHandler->replaceArgument(2, new Reference($this->getFailureHandlerId($id)));
$listener = $container->getDefinition($listenerId);
$listener->replaceArgument(5, new Reference($simpleAuthHandlerId));
$listener->replaceArgument(6, new Reference($simpleAuthHandlerId));
$listener->addArgument(new Reference($config['authenticator']));

0 comments on commit b3f5fa9

Please sign in to comment.