request->has(static::AUTH_FIELD) || $request->query->has(static::AUTH_FIELD); } public function authenticate(Request $request): Passport { $identifier = $request->request->get(static::AUTH_FIELD); if (null === $identifier) { throw new AuthenticationException('Request does not contain authentication data'); } return new SelfValidatingPassport( new UserBadge($identifier, function ($userIdentifier) { return $this->repository->findOneBy([static::AUTH_FIELD => $userIdentifier]); }), [] ); } }