summaryrefslogtreecommitdiffstats
path: root/Http/Authentication/DefaultAuthenticationSuccessHandler.php
diff options
context:
space:
mode:
authorAlexander <iam.asm89@gmail.com>2012-07-11 20:32:56 +0200
committerAlexander <iam.asm89@gmail.com>2012-07-12 12:03:58 +0200
commitb8d0ed72c14a8068aa604cd42974bc6e64547579 (patch)
treef01735ccdb3c41cd6e8cb8558a63b529ff7b5006 /Http/Authentication/DefaultAuthenticationSuccessHandler.php
parent47fcb4bfc03c74ae5b7ba6c6f2c32169e455be02 (diff)
downloadsymfony-security-b8d0ed72c14a8068aa604cd42974bc6e64547579.zip
symfony-security-b8d0ed72c14a8068aa604cd42974bc6e64547579.tar.gz
symfony-security-b8d0ed72c14a8068aa604cd42974bc6e64547579.tar.bz2
[Security] Remove hard dependency on $providerKey for default auth success handler
Diffstat (limited to 'Http/Authentication/DefaultAuthenticationSuccessHandler.php')
-rw-r--r--Http/Authentication/DefaultAuthenticationSuccessHandler.php30
1 files changed, 24 insertions, 6 deletions
diff --git a/Http/Authentication/DefaultAuthenticationSuccessHandler.php b/Http/Authentication/DefaultAuthenticationSuccessHandler.php
index deb7d45..66d6bda 100644
--- a/Http/Authentication/DefaultAuthenticationSuccessHandler.php
+++ b/Http/Authentication/DefaultAuthenticationSuccessHandler.php
@@ -35,13 +35,11 @@ class DefaultAuthenticationSuccessHandler implements AuthenticationSuccessHandle
* Constructor.
*
* @param HttpUtils $httpUtils
- * @param string $providerKey
* @param array $options Options for processing a successful authentication attempt.
*/
- public function __construct(HttpUtils $httpUtils, $providerKey, array $options)
+ public function __construct(HttpUtils $httpUtils, array $options)
{
$this->httpUtils = $httpUtils;
- $this->providerKey = $providerKey;
$this->options = array_merge(array(
'always_use_default_target_path' => false,
@@ -60,6 +58,27 @@ class DefaultAuthenticationSuccessHandler implements AuthenticationSuccessHandle
return $this->httpUtils->createRedirectResponse($request, $this->determineTargetUrl($request));
}
+
+ /**
+ * Get the provider key.
+ *
+ * @return string
+ */
+ public function getProviderKey()
+ {
+ return $this->providerKey;
+ }
+
+ /**
+ * Set the provider key.
+ *
+ * @param string $providerKey
+ */
+ public function setProviderKey($providerKey)
+ {
+ $this->providerKey = $providerKey;
+ }
+
/**
* Builds the target URL according to the defined options.
*
@@ -77,9 +96,8 @@ class DefaultAuthenticationSuccessHandler implements AuthenticationSuccessHandle
return $targetUrl;
}
- $session = $request->getSession();
- if ($targetUrl = $session->get('_security.'.$this->providerKey.'.target_path')) {
- $session->remove('_security.'.$this->providerKey.'.target_path');
+ if (null !== $this->providerKey && $targetUrl = $request->getSession()->get('_security.'.$this->providerKey.'.target_path')) {
+ $request->getSession()->remove('_security.'.$this->providerKey.'.target_path');
return $targetUrl;
}