$userBadge =
new UserBadge($username,
function D
) use ($request) { try { $user =
$this->loginLinkHandler->
consumeLoginLink($request);
} catch (InvalidLoginLinkExceptionInterface
$e) { throw new InvalidLoginLinkAuthenticationException('Login link could not be validated.', 0,
$e);
} return $user;
});
return new SelfValidatingPassport($userBadge,
[new RememberMeBadge()]);
} public function onAuthenticationSuccess(Request
$request, TokenInterface
$token, string
$firewallName): ?Response
{ return $this->successHandler->
onAuthenticationSuccess($request,
$token);
} public function onAuthenticationFailure(Request
$request, AuthenticationException
$exception): Response
{ return $this->failureHandler->
onAuthenticationFailure($request,
$exception);
}