[Security] fixes multiple overlapping definitions of DefaultFailureHandler and DefaultSuccessHandler in AbstractFactory
This commit is contained in:
parent
8c2f35f2ce
commit
39157a852d
@ -172,7 +172,7 @@ abstract class AbstractFactory implements SecurityFactoryInterface
|
|||||||
return $config['success_handler'];
|
return $config['success_handler'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$successHandlerId = 'security.authentication.success_handler.'.$id;
|
$successHandlerId = 'security.authentication.success_handler.'.$id.'.'.str_replace('-', '_', $this->getKey());
|
||||||
|
|
||||||
$successHandler = $container->setDefinition($successHandlerId, new DefinitionDecorator('security.authentication.success_handler'));
|
$successHandler = $container->setDefinition($successHandlerId, new DefinitionDecorator('security.authentication.success_handler'));
|
||||||
$successHandler->replaceArgument(1, array_intersect_key($config, $this->defaultSuccessHandlerOptions));
|
$successHandler->replaceArgument(1, array_intersect_key($config, $this->defaultSuccessHandlerOptions));
|
||||||
@ -187,7 +187,7 @@ abstract class AbstractFactory implements SecurityFactoryInterface
|
|||||||
return $config['failure_handler'];
|
return $config['failure_handler'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$id = 'security.authentication.failure_handler.'.$id;
|
$id = 'security.authentication.failure_handler.'.$id.'.'.str_replace('-', '_', $this->getKey());
|
||||||
|
|
||||||
$failureHandler = $container->setDefinition($id, new DefinitionDecorator('security.authentication.failure_handler'));
|
$failureHandler = $container->setDefinition($id, new DefinitionDecorator('security.authentication.failure_handler'));
|
||||||
$failureHandler->replaceArgument(2, array_intersect_key($config, $this->defaultFailureHandlerOptions));
|
$failureHandler->replaceArgument(2, array_intersect_key($config, $this->defaultFailureHandlerOptions));
|
||||||
|
@ -54,7 +54,7 @@ class AbstractFactoryTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$definition = $container->getDefinition('abstract_listener.foo');
|
$definition = $container->getDefinition('abstract_listener.foo');
|
||||||
$arguments = $definition->getArguments();
|
$arguments = $definition->getArguments();
|
||||||
$this->assertEquals(new Reference('security.authentication.failure_handler.foo'), $arguments['index_6']);
|
$this->assertEquals(new Reference('security.authentication.failure_handler.foo.abstract_factory'), $arguments['index_6']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDefaultSuccessHandler()
|
public function testDefaultSuccessHandler()
|
||||||
@ -67,7 +67,7 @@ class AbstractFactoryTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$definition = $container->getDefinition('abstract_listener.foo');
|
$definition = $container->getDefinition('abstract_listener.foo');
|
||||||
$arguments = $definition->getArguments();
|
$arguments = $definition->getArguments();
|
||||||
$this->assertEquals(new Reference('security.authentication.success_handler.foo'), $arguments['index_5']);
|
$this->assertEquals(new Reference('security.authentication.success_handler.foo.abstract_factory'), $arguments['index_5']);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function callFactory($id, $config, $userProviderId, $defaultEntryPointId)
|
protected function callFactory($id, $config, $userProviderId, $defaultEntryPointId)
|
||||||
@ -84,6 +84,11 @@ class AbstractFactoryTest extends \PHPUnit_Framework_TestCase
|
|||||||
->method('getListenerId')
|
->method('getListenerId')
|
||||||
->will($this->returnValue('abstract_listener'))
|
->will($this->returnValue('abstract_listener'))
|
||||||
;
|
;
|
||||||
|
$factory
|
||||||
|
->expects($this->any())
|
||||||
|
->method('getKey')
|
||||||
|
->will($this->returnValue('abstract_factory'))
|
||||||
|
;
|
||||||
|
|
||||||
$container = new ContainerBuilder();
|
$container = new ContainerBuilder();
|
||||||
$container->register('auth_provider');
|
$container->register('auth_provider');
|
||||||
|
Reference in New Issue
Block a user