// get the passport from the Authenticator
$passport =
$authenticator->
authenticate($request);
// check the passport (e.g. password checking)
$event =
new CheckPassportEvent($authenticator,
$passport);
$this->eventDispatcher->
dispatch($event);
// check if all badges are resolved
$resolvedBadges =
[];
foreach ($passport->
getBadges() as $badge) { if (!
$badge->
isResolved()) { throw new BadCredentialsException(sprintf('Authentication failed: Security badge "%s" is not resolved, did you forget to register the correct listeners?',
get_debug_type($badge)));
} $resolvedBadges[] =
$badge::
class;
} $missingRequiredBadges =
array_diff($this->requiredBadges,
$resolvedBadges);
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