authorizationService = $authorizationService; $this->client = $client; $this->redirectUri = $redirectUri; $this->maxAge = $maxAge; } #[Override] public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { $client = $this->client ?? $request->getAttribute(ClientInterface::class); $authSession = $request->getAttribute(AuthSessionInterface::class); if (! $client instanceof ClientInterface) { throw new LogicException('No OpenID client provided'); } if (null !== $authSession && ! $authSession instanceof AuthSessionInterface) { throw new LogicException('Invalid auth session provided in attribute ' . AuthSessionInterface::class); } $params = $this->authorizationService->getCallbackParams($request, $client); $tokenSet = $this->authorizationService->callback( $client, $params, $this->redirectUri, $authSession, $this->maxAge ); return $handler->handle($request->withAttribute(TokenSetInterface::class, $tokenSet)); } }