Debian Codegraph @

lib/3rdParty/composer/web-token/jwt-library/KeyManagement/JKUFactory.php

raw symbols SCIP
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Jose\Component\KeyManagement;
6
7 use Jose\Component\Core\JWKSet;
8 use Jose\Component\Core\Util\JsonConverter;
9 use RuntimeException;
10 use function is_array;
11
12 class JKUFactory extends UrlKeySetFactory
13 {
14 /**
15 * This method will try to fetch the url a retrieve the key set. Throws an exception in case of failure.
16 */
17 public function loadFromUrl(string $url, array $header = []): JWKSet
18 {
19 $content = $this->getContent($url, $header);
20 $data = JsonConverter::decode($content);
21 if (! is_array($data)) {
22 throw new RuntimeException('Invalid content.');
23 }
24
25 return JWKSet::createFromKeyData($data);
26 }
27 }