userInfoService = $userInfoService; $this->client = $client; } #[Override] public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { $tokenSet = $request->getAttribute(TokenSetInterface::class); $client = $this->client ?? $request->getAttribute(ClientInterface::class); if (! $client instanceof ClientInterface) { throw new LogicException('No OpenID client provided'); } if (! $tokenSet instanceof TokenSetInterface) { throw new RuntimeException('Unable to get token response attribute'); } $claims = $this->userInfoService->getUserInfo($client, $tokenSet); return $handler->handle($request->withAttribute(self::USERINFO_ATTRIBUTE, $claims)); } }