| 1 | <?php |
||
| 16 | final class JKUFinder implements JWKFinderInterface |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * {@inheritdoc} |
||
| 20 | */ |
||
| 21 | public function findJWK(array $header) |
||
| 22 | { |
||
| 23 | if (!isset($header['jku'])) { |
||
| 24 | return; |
||
| 25 | } |
||
| 26 | |||
| 27 | $content = $this->downloadContent($header['jku']); |
||
| 28 | if (null === $content) { |
||
| 29 | return; |
||
| 30 | } |
||
| 31 | $content = json_decode($content, true); |
||
| 32 | if (!is_array($content) || !array_key_exists('keys', $content)) { |
||
| 33 | return; |
||
| 34 | } |
||
| 35 | |||
| 36 | return $content; |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @param string $url |
||
| 41 | * |
||
| 42 | * @return string|void |
||
| 43 | */ |
||
| 44 | protected function downloadContent($url) |
||
| 63 | } |
||
| 64 |