summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;
}