Permalink
Browse files

[Security] Fix regression after rebase. Target url should be firewall…

… dependent
  • Loading branch information...
1 parent eb19f2c commit bb138dadb3ad5a0b5850fc25bd2f9ec8d47880ed @asm89 committed Jul 6, 2012
View
9 src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AbstractFactory.php
@@ -172,12 +172,13 @@ protected function createAuthenticationSuccessHandler($container, $id, $config)
return $config['success_handler'];
}
- $id = 'security.authentication.success_handler.'.$id;
+ $successHandlerId = 'security.authentication.success_handler.'.$id;
- $successHandler = $container->setDefinition($id, new DefinitionDecorator('security.authentication.success_handler'));
- $successHandler->replaceArgument(1, array_intersect_key($config, $this->defaultSuccessHandlerOptions));
+ $successHandler = $container->setDefinition($successHandlerId, new DefinitionDecorator('security.authentication.success_handler'));
+ $successHandler->replaceArgument(1, $id);
+ $successHandler->replaceArgument(2, array_intersect_key($config, $this->defaultSuccessHandlerOptions));
- return $id;
+ return $successHandlerId;
}
protected function createAuthenticationFailureHandler($container, $id, $config)
View
1 src/Symfony/Bundle/SecurityBundle/Resources/config/security_listeners.xml
@@ -111,6 +111,7 @@
<service id="security.authentication.success_handler" class="%security.authentication.success_handler.class%" abstract="true" public="false">
<argument type="service" id="security.http_utils" />
<argument />
+ <argument />
</service>
<service id="security.authentication.failure_handler" class="%security.authentication.failure_handler.class%" abstract="true" public="false">
View
11 src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationSuccessHandler.php
@@ -29,16 +29,19 @@ class DefaultAuthenticationSuccessHandler implements AuthenticationSuccessHandle
{
protected $httpUtils;
protected $options;
+ protected $providerKey;
/**
* Constructor.
*
* @param HttpUtils $httpUtils
+ * @param string $providerKey
* @param array $options Options for processing a successful authentication attempt.
*/
- public function __construct(HttpUtils $httpUtils, array $options)
+ public function __construct(HttpUtils $httpUtils, $providerKey, array $options)
{
- $this->httpUtils = $httpUtils;
+ $this->httpUtils = $httpUtils;
+ $this->providerKey = $providerKey;
$this->options = array_merge(array(
'always_use_default_target_path' => false,
@@ -75,8 +78,8 @@ protected function determineTargetUrl(Request $request)
}
$session = $request->getSession();
- if ($targetUrl = $session->get('_security.target_path')) {
- $session->remove('_security.target_path');
+ if ($targetUrl = $session->get('_security.'.$this->providerKey.'.target_path')) {
+ $session->remove('_security.'.$this->providerKey.'.target_path');
return $targetUrl;
}
View
2 src/Symfony/Component/Security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php
@@ -37,7 +37,7 @@ class UsernamePasswordFormAuthenticationListener extends AbstractAuthenticationL
/**
* {@inheritdoc}
*/
- public function __construct(SecurityContextInterface $securityContext, AuthenticationManagerInterface $authenticationManager, SessionAuthenticationStrategyInterface $sessionStrategy, HttpUtils $httpUtils, $providerKey, AuthenticationSuccessHandlerInterface $successHandler = null, AuthenticationFailureHandlerInterface $failureHandler, array $options = array(), LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null, CsrfProviderInterface $csrfProvider = null)
+ public function __construct(SecurityContextInterface $securityContext, AuthenticationManagerInterface $authenticationManager, SessionAuthenticationStrategyInterface $sessionStrategy, HttpUtils $httpUtils, $providerKey, AuthenticationSuccessHandlerInterface $successHandler, AuthenticationFailureHandlerInterface $failureHandler, array $options = array(), LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null, CsrfProviderInterface $csrfProvider = null)
{
parent::__construct($securityContext, $authenticationManager, $sessionStrategy, $httpUtils, $providerKey, $successHandler, $failureHandler, array_merge(array(
'username_parameter' => '_username',

0 comments on commit bb138da

Please sign in to comment.