private function handleAuthenticationSuccess(TokenInterface
$authenticatedToken, Passport
$passport, Request
$request, AuthenticatorInterface
$authenticator, ?TokenInterface
$previousToken): ?Response
{ $this->tokenStorage->
setToken($authenticatedToken);
$response =
$authenticator->
onAuthenticationSuccess($request,
$authenticatedToken,
$this->firewallName
);
if ($authenticator instanceof InteractiveAuthenticatorInterface &&
$authenticator->
isInteractive()) { $loginEvent =
new InteractiveLoginEvent($request,
$authenticatedToken);
$this->eventDispatcher->
dispatch($loginEvent, SecurityEvents::INTERACTIVE_LOGIN
);
} $this->eventDispatcher->
dispatch($loginSuccessEvent =
new LoginSuccessEvent($authenticator,
$passport,
$authenticatedToken,
$request,
$response,
$this->firewallName,
$previousToken));
return $loginSuccessEvent->
getResponse();
} /**
* Handles an authentication failure and returns the Response for the authenticator.
*/
private function handleAuthenticationFailure(AuthenticationException
$authenticationException, Request
$request, AuthenticatorInterface
$authenticator, ?Passport
$passport): ?Response
{ $this->logger?->
info('Authenticator failed.',
['exception' =>
$authenticationException, 'authenticator'
=> ($authenticator instanceof TraceableAuthenticator ?
$authenticator->
getAuthenticator() :
$authenticator)::
class]);