Authentication(Success|Failure)Handler can now return null
This commit is contained in:
parent
06da573d04
commit
ed9c34822b
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user