diff options
author | Fabien Potencier <fabien.potencier@gmail.com> | 2014-09-23 09:57:52 +0200 |
---|---|---|
committer | Fabien Potencier <fabien.potencier@gmail.com> | 2014-09-23 11:07:07 +0200 |
commit | 178db058771ccf57bf78b3e2ea1695bdd45ca864 (patch) | |
tree | 866165db9ea8a06a3166ebdd004a5f113c32dbac /Http/Authentication/DefaultAuthenticationSuccessHandler.php | |
parent | 729bef85463490cebd41160e3a111954f63a1638 (diff) | |
download | symfony-security-178db058771ccf57bf78b3e2ea1695bdd45ca864.zip symfony-security-178db058771ccf57bf78b3e2ea1695bdd45ca864.tar.gz symfony-security-178db058771ccf57bf78b3e2ea1695bdd45ca864.tar.bz2 |
[Security] made it possible to override the default success/failure handler
Diffstat (limited to 'Http/Authentication/DefaultAuthenticationSuccessHandler.php')
-rw-r--r-- | Http/Authentication/DefaultAuthenticationSuccessHandler.php | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/Http/Authentication/DefaultAuthenticationSuccessHandler.php b/Http/Authentication/DefaultAuthenticationSuccessHandler.php index 54d6fc1..0ee11b4 100644 --- a/Http/Authentication/DefaultAuthenticationSuccessHandler.php +++ b/Http/Authentication/DefaultAuthenticationSuccessHandler.php @@ -27,6 +27,13 @@ class DefaultAuthenticationSuccessHandler implements AuthenticationSuccessHandle protected $httpUtils; protected $options; protected $providerKey; + protected $defaultOptions = array( + 'always_use_default_target_path' => false, + 'default_target_path' => '/', + 'login_path' => '/login', + 'target_path_parameter' => '_target_path', + 'use_referer' => false, + ); /** * Constructor. @@ -34,17 +41,10 @@ class DefaultAuthenticationSuccessHandler implements AuthenticationSuccessHandle * @param HttpUtils $httpUtils * @param array $options Options for processing a successful authentication attempt. */ - public function __construct(HttpUtils $httpUtils, array $options) + public function __construct(HttpUtils $httpUtils, array $options = array()) { - $this->httpUtils = $httpUtils; - - $this->options = array_merge(array( - 'always_use_default_target_path' => false, - 'default_target_path' => '/', - 'login_path' => '/login', - 'target_path_parameter' => '_target_path', - 'use_referer' => false, - ), $options); + $this->httpUtils = $httpUtils; + $this->setOptions($options); } /** @@ -56,6 +56,26 @@ class DefaultAuthenticationSuccessHandler implements AuthenticationSuccessHandle } /** + * Gets the options. + * + * @return array An array of options + */ + public function getOptions() + { + return $this->options; + } + + /** + * Sets the options. + * + * @param array $options An array of options + */ + public function setOptions(array $options) + { + $this->options = array_merge($this->defaultOptions, $options); + } + + /** * Get the provider key. * * @return string |