summaryrefslogtreecommitdiffstats
path: root/Http
diff options
context:
space:
mode:
authorOlivier Dolbeau <odolbeau@lafourchette.com>2012-01-24 17:36:01 +0100
committerOlivier Dolbeau <odolbeau@lafourchette.com>2012-01-24 17:57:22 +0100
commit1c7baca3ae299de80754f7dcb94ee4a7637f7f74 (patch)
tree5bf773b9cc795cf8b44120eae9a887df026bd392 /Http
parent41adf77f0ab66a12202bf123baaf5d1b90e01176 (diff)
downloadsymfony-security-1c7baca3ae299de80754f7dcb94ee4a7637f7f74.zip
symfony-security-1c7baca3ae299de80754f7dcb94ee4a7637f7f74.tar.gz
symfony-security-1c7baca3ae299de80754f7dcb94ee4a7637f7f74.tar.bz2
Authentication(Success|Failure)Handler can now return null
Diffstat (limited to 'Http')
-rw-r--r--Http/Authentication/AuthenticationFailureHandlerInterface.php2
-rw-r--r--Http/Authentication/AuthenticationSuccessHandlerInterface.php2
-rw-r--r--Http/Firewall/AbstractAuthenticationListener.php8
3 files changed, 8 insertions, 4 deletions
diff --git a/Http/Authentication/AuthenticationFailureHandlerInterface.php b/Http/Authentication/AuthenticationFailureHandlerInterface.php
index d5d0067..7a5cc23 100644
--- a/Http/Authentication/AuthenticationFailureHandlerInterface.php
+++ b/Http/Authentication/AuthenticationFailureHandlerInterface.php
@@ -33,7 +33,7 @@ interface AuthenticationFailureHandlerInterface
* @param Request $request
* @param AuthenticationException $exception
*
- * @return Response the response to return
+ * @return Response|null the response to return
*/
function onAuthenticationFailure(Request $request, AuthenticationException $exception);
}
diff --git a/Http/Authentication/AuthenticationSuccessHandlerInterface.php b/Http/Authentication/AuthenticationSuccessHandlerInterface.php
index 3d7c561..1a46ad4 100644
--- a/Http/Authentication/AuthenticationSuccessHandlerInterface.php
+++ b/Http/Authentication/AuthenticationSuccessHandlerInterface.php
@@ -33,7 +33,7 @@ interface AuthenticationSuccessHandlerInterface
* @param Request $request
* @param TokenInterface $token
*
- * @return Response the response to return
+ * @return Response|null the response to return
*/
function onAuthenticationSuccess(Request $request, TokenInterface $token);
}
diff --git a/Http/Firewall/AbstractAuthenticationListener.php b/Http/Firewall/AbstractAuthenticationListener.php
index 99f92b8..4c6689e 100644
--- a/Http/Firewall/AbstractAuthenticationListener.php
+++ b/Http/Firewall/AbstractAuthenticationListener.php
@@ -192,7 +192,9 @@ abstract class AbstractAuthenticationListener implements ListenerInterface
$this->securityContext->setToken(null);
if (null !== $this->failureHandler) {
- return $this->failureHandler->onAuthenticationFailure($request, $failed);
+ if (null !== $response = $this->failureHandler->onAuthenticationFailure($request, $failed)) {
+ return $response;
+ }
}
if (null === $this->options['failure_path']) {
@@ -236,9 +238,11 @@ abstract class AbstractAuthenticationListener implements ListenerInterface
$this->dispatcher->dispatch(SecurityEvents::INTERACTIVE_LOGIN, $loginEvent);
}
+ $response = null;
if (null !== $this->successHandler) {
$response = $this->successHandler->onAuthenticationSuccess($request, $token);
- } else {
+ }
+ if (null === $response) {
$response = $this->httpUtils->createRedirectResponse($request, $this->determineTargetUrl($request));
}