security = $security; $this->repository = $repository; } /** * {@inheritdoc } */ public function supports(Request $request): bool { if ($this->security->getUser()) { return false; } return $request->request->has(static::AUTH_FIELD); } /** * {@inheritdoc } */ public function authenticate(Request $request): Passport { $identifier = $request->request->get(static::AUTH_FIELD); return new SelfValidatingPassport( new UserBadge($identifier, function ($userIdentifier) { return $this->repository->findByIdentifier($userIdentifier); }), [new RememberMeBadge()] ); } }