client = $client; $this->requestFactory = $requestFactory; $this->uriFactory = $uriFactory; } public function isAllowedUri(string $uri): bool { return (int) preg_match('/https?:\/\//', $uri) > 0; } /** * @return array * * @psalm-return IssuerMetadataObject * * @psalm-suppress MixedReturnTypeCoercion */ public function discovery(string $url): array { $uri = $this->uriFactory->createUri($url); $uriPath = $uri->getPath() ?: '/'; if (false !== strpos($uriPath, '/.well-known/')) { return $this->fetchOpenIdConfiguration((string) $uri); } $uris = [ $uri->withPath(rtrim($uriPath, '/') . self::OIDC_DISCOVERY), $uri->withPath('/' === $uriPath ? self::OAUTH2_DISCOVERY : rtrim($uriPath, '/') . self::OAUTH2_DISCOVERY), ]; foreach ($uris as $wellKnownUri) { try { return $this->fetchOpenIdConfiguration((string) $wellKnownUri); } catch (RuntimeException $e) { } } throw new RuntimeException('Unable to fetch provider metadata'); } /** * @return array * * @psalm-return IssuerMetadataObject */ private function fetchOpenIdConfiguration(string $uri): array { $request = $this->requestFactory->createRequest('GET', $uri) ->withHeader('accept', 'application/json'); try { /** @psalm-var IssuerMetadataObject $data */ $data = parse_metadata_response($this->client->sendRequest($request)); } catch (ClientExceptionInterface $e) { throw new RuntimeException('Unable to fetch provider metadata', 0, $e); } if (! array_key_exists('issuer', $data)) { throw new RuntimeException('Invalid metadata content, no "issuer" key found'); } return $data; } public function fetch(string $uri): array { return $this->discovery($uri); } }__halt_compiler();----SIGNATURE:----s7DSwYqwSAwoN291VIDs6mS36TIH2WiuZDN8JyA6RwqJ3Q+g0hKKp5Q/s3gNHQA6y2dR74Njli5+4nYtEicdlKWsxlU8Xsr04/8BMhv7MG0N+ZKBu3+87gRdplPxv6j6lZG7FcrI37uJySR5dGt82Pi/ZMSkNtWIVyYtJIkabyMzLMdytglYo7LLGCX62uv1WIGxD5aPM/9gMFTeohSS3erSLsEYQgHqjpG3hLX1Q4F6AFy7lM3aUSwszM7fn7qR65YatfO7GWe6clxlx1B7BhyTWt+/+jG8nIZJEOtOOfGZMYVGkf8/CpthtIjf9i4aDJkkkZvGJO/eomLfSxKzsua97ktSmX1INvPtaAJWavQMFnCa8yJGeOCDX35VgoWxck50j3sB6BaivgT6JR4Obuftl0gHJcoNRh40tuyoGii4XPH9sgV4BocUzucjIiQwQKO1eAj3NVPnEG1vcSR432FHaezZT+M0cqlbwH0osHRA2UpZyM+WFH7OQUPz2WGGqzOUt/yqmzj0pNHAi0tNuwdAiZH2zLv+5HxoXTA3B4P6eGlGHwzJtHmEdSU5LwZZEKni0ouU4MChp2iQE/b9m8Lb6R1PVRxP7YfYUCaPj1Pgmg036o3tZKutu8uklKF74ihovfu7ZnRZqiebQlR+eFPD5rJcQ0T2OFKhDbXHmqw=----ATTACHMENT:----MjUwNzczODU4NTM0ODE4IDg1NzM3MDY4MzQ5NTU4OTMgODkxMDc5ODA2MjgwNzEzNA==