client = $client; $this->requestFactory = $requestFactory; } /** * @param array $params */ public function revoke(OpenIDClient $client, string $token, array $params = []): void { $endpointUri = get_endpoint_uri($client, 'revocation_endpoint'); $authMethod = $client->getAuthMethodFactory() ->create($client->getMetadata()->getRevocationEndpointAuthMethod()); $tokenRequest = $this->requestFactory->createRequest('POST', $endpointUri) ->withHeader('content-type', 'application/x-www-form-urlencoded'); $params['token'] = $token; $tokenRequest = $authMethod->createRequest($tokenRequest, $client, $params); $httpClient = $client->getHttpClient() ?? $this->client; try { $response = $httpClient->sendRequest($tokenRequest); check_server_response($response, 200); } catch (ClientExceptionInterface $e) { throw new RuntimeException('Unable to get revocation response', 0, $e); } } }