bug #10095 [Security] fix DI for SimpleFormAuthenticationListener (Tobion)
This PR was merged into the 2.4 branch. Discussion ---------- [Security] fix DI for SimpleFormAuthenticationListener | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #10093 | License | MIT | Doc PR | - The problematic commit wasf2f15f54f9
Commits -------b3f5fa9
[Security] fix DI for SimpleFormAuthenticationListener
This commit is contained in:
commit
8c47a9fabc
@ -75,12 +75,10 @@ class FormLoginFactory extends AbstractFactory
|
||||
{
|
||||
$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,11 +63,6 @@ class SimpleFormFactory extends FormLoginFactory
|
||||
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'));
|
||||
@ -75,6 +70,7 @@ class SimpleFormFactory extends FormLoginFactory
|
||||
$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']));
|
||||
|
Reference in New Issue
Block a user