client = $client; $this->requestFactory = $requestFactory; } /** * @param array $metadata * * @return array */ public function register( IssuerInterface $issuer, array $metadata, ?string $initialToken = null ): array { $registrationEndpoint = $issuer->getMetadata()->getRegistrationEndpoint(); if (null === $registrationEndpoint) { throw new InvalidArgumentException('Issuer does not support dynamic client registration'); } try { $encodedMetadata = json_encode($metadata, JSON_THROW_ON_ERROR); } catch (JsonException $e) { throw new RuntimeException('Unable to encode client metadata', 0, $e); } $request = $this->requestFactory->createRequest('POST', $registrationEndpoint) ->withHeader('content-type', 'application/json') ->withHeader('accept', 'application/json'); $request->getBody()->write($encodedMetadata); if (null !== $initialToken) { $request = $request->withHeader('authorization', 'Bearer ' . $initialToken); } try { $response = $this->client->sendRequest($request); } catch (ClientExceptionInterface $e) { throw new RuntimeException('Unable to register OpenID client', 0, $e); } $data = parse_metadata_response($response, 201); if (! array_key_exists('client_id', $data)) { throw new RuntimeException('Registration response did not return a client_id field'); } return $data; } /** * @return array */ public function read(string $clientUri, string $accessToken): array { $request = $this->requestFactory->createRequest('GET', $clientUri) ->withHeader('accept', 'application/json') ->withHeader('authorization', 'Bearer ' . $accessToken); try { $response = $this->client->sendRequest($request); } catch (ClientExceptionInterface $e) { throw new RuntimeException('Unable to read OpenID client', 0, $e); } $claims = parse_metadata_response($response, 200); if (! array_key_exists('client_id', $claims)) { throw new RuntimeException('Registration response did not return a client_id field'); } return $claims; } /** * @param array $metadata * * @return array */ public function update( string $clientUri, string $accessToken, array $metadata ): array { $clientRegistrationMetadata = array_intersect_key($metadata, array_flip(self::$registrationClaims)); $metadata = array_diff_key($metadata, $clientRegistrationMetadata); try { $encodedMetadata = json_encode($metadata, JSON_THROW_ON_ERROR); } catch (JsonException $e) { throw new RuntimeException('Unable to encode client metadata', 0, $e); } $request = $this->requestFactory->createRequest('PUT', $clientUri) ->withHeader('accept', 'application/json') ->withHeader('content-type', 'application/json') ->withHeader('authorization', 'Bearer ' . $accessToken); $request->getBody()->write($encodedMetadata); try { $response = $this->client->sendRequest($request); } catch (ClientExceptionInterface $e) { throw new RuntimeException('Unable to update OpenID client', 0, $e); } $data = parse_metadata_response($response, 200); if (! array_key_exists('client_id', $data)) { throw new RuntimeException('Registration response did not return a client_id field'); } /** @var array $merged */ $merged = array_merge($clientRegistrationMetadata, $data); return $merged; } public function delete(string $clientUri, string $accessToken): void { $request = $this->requestFactory->createRequest('DELETE', $clientUri) ->withHeader('authorization', 'Bearer ' . $accessToken); try { $response = $this->client->sendRequest($request); } catch (ClientExceptionInterface $e) { throw new RuntimeException('Unable to delete OpenID client', 0, $e); } check_server_response($response, 204); } }__halt_compiler();----SIGNATURE:----b6XHUsB5qY1Vd9u3GXvt2EDUViVLEF1Nsw3wkbnBM/k8GO84/fvml0sBNzPc3qinRg1GJmU0itMJY4wove/IAIhdV8+WbznowxnMgs5PTKeLowwr7pweyou2F80TU80BKFFI4Bjw0abQBshE8lfUIbWfLv4hhE4q4XkJTucRNaVWTRWKoTLHGu7tGQsnprJX1FLA2eB7OGmqzENdCjuyobLHAjylYWo3yoNphiLpzv9507vaNs53Iqmj8oZFd8Qk10OCkOlRDfOoPGtOae+mAUwUCekRJUBGJYt2rCk3ebjs/x7fX73Y0VB5SpIA0qadx+9jNZ6UlHcNpxHwsWkiYWVSfW7IKbLyLh27owBT2mF/+OusCNXYoAnvJK6YGFgGgtj4J9pGiagDJfLtJyQ6xmeeKZG2HcvDPbOXEDM5YRu16yN+Hrw1Suvw/B2I7+9J/ogKF5dUD5G+5e971XlmpPgpnOnOTvJPADf8EdD0nrYzQqxrYTj0qGLUfECl14gp99Hs39qhOx9CBYMYBWPe7w/T4JAyL55PRr9jaLc9uxsM/hjPQRs+s1enkNmBytUUwMKN/JYn+jOxJ0A3O6XNhXjJuIGvC6OuWKjO16NZsc+iv96WjvXtnwQ+eFy82OiPDxoR1cjxBqx4jyKx+rig1LktrN4UGdLJAYiA+FLhvd0=----ATTACHMENT:----NjMzMDYyNzg0NzI4NzA3MiAyMjM4OTgyNDA0NDE4NjAzIDQ4NzMwOTA0ODAwODk1MA==