if ($missingRequiredBadges) { throw new BadCredentialsException(sprintf('Authentication failed; Some badges marked as required by the firewall config are not available on the passport: "%s".',
implode('", "',
$missingRequiredBadges)));
} // create the authentication token
$authenticatedToken =
$authenticator->
createToken($passport,
$this->firewallName
);
// announce the authentication token
$authenticatedToken =
$this->eventDispatcher->
dispatch(new AuthenticationTokenCreatedEvent($authenticatedToken,
$passport))->
getAuthenticatedToken();
if (true ===
$this->eraseCredentials
) { $authenticatedToken->
eraseCredentials();
} $this->eventDispatcher->
dispatch(new AuthenticationSuccessEvent($authenticatedToken), AuthenticationEvents::AUTHENTICATION_SUCCESS
);
$this->logger?->
info('Authenticator successful!',
['token' =>
$authenticatedToken, 'authenticator'
=> ($authenticator instanceof TraceableAuthenticator ?
$authenticator->
getAuthenticator() :
$authenticator)::
class]);
} catch (AuthenticationException
$e) { // oh no! Authentication failed!
$response =
$this->
handleAuthenticationFailure($e,
$request,
$authenticator,
$passport);
if ($response instanceof Response
) { return $response;
}