[Security] Fix regression after rebase. Target url should be firewall dependent
This commit is contained in:
parent
eb19f2c9e3
commit
bb138dadb3
@ -172,12 +172,13 @@ abstract class AbstractFactory implements SecurityFactoryInterface
|
||||
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)
|
||||
|
@ -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">
|
||||
|
@ -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 @@ class DefaultAuthenticationSuccessHandler implements AuthenticationSuccessHandle
|
||||
}
|
||||
|
||||
$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;
|
||||
}
|
||||
|
@ -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',
|
||||
|
Reference in New Issue
Block a user