From 1618d5e4cb7df5e066d0e3693058ffd177b56693 Mon Sep 17 00:00:00 2001 From: Volker Date: Sun, 17 Aug 2014 18:42:26 +0200 Subject: [PATCH] Extend AbstractFactory for easy extending by this way, it is possible to use the hole abstract class and just override the 4 last getter functions. it will this class more reuseable! --- .../Security/Factory/AbstractFactory.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AbstractFactory.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AbstractFactory.php index 08b5234eee17..a0a597d8a163 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AbstractFactory.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AbstractFactory.php @@ -176,7 +176,7 @@ protected function createAuthenticationSuccessHandler($container, $id, $config) $successHandlerId = $this->getSuccessHandlerId($id); - $successHandler = $container->setDefinition($successHandlerId, new DefinitionDecorator('security.authentication.success_handler')); + $successHandler = $container->setDefinition($successHandlerId, new DefinitionDecorator($this->getDefaultAuthenticationSuccessHandlerServiceId())); $successHandler->replaceArgument(1, array_intersect_key($config, $this->defaultSuccessHandlerOptions)); $successHandler->addMethodCall('setProviderKey', array($id)); @@ -189,12 +189,22 @@ protected function createAuthenticationFailureHandler($container, $id, $config) return $config['failure_handler']; } - $id = $this->getFailureHandlerId($id); + $failureHandlerId = $this->getFailureHandlerId($id); - $failureHandler = $container->setDefinition($id, new DefinitionDecorator('security.authentication.failure_handler')); + $failureHandler = $container->setDefinition($failureHandlerId, new DefinitionDecorator($this->getDefaultAuthenticationFailureHandlerServiceId())); $failureHandler->replaceArgument(2, array_intersect_key($config, $this->defaultFailureHandlerOptions)); - return $id; + return $failureHandlerId; + } + + protected function getDefaultAuthenticationFailureHandlerServiceId() + { + return 'security.authentication.failure_handler'; + } + + protected function getDefaultAuthenticationSuccessHandlerServiceId() + { + return 'security.authentication.success_handler'; } protected function getSuccessHandlerId($id)