| Conditions | 4 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4.0119 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | 10 | protected function getSigningJWKSet(ClientInterface $client, string $expectedAlg, ?string $kid = null): JWKSet |
|
| 17 | { |
||
| 18 | 10 | $metadata = $client->getMetadata(); |
|
| 19 | 10 | $issuer = $client->getIssuer(); |
|
| 20 | |||
| 21 | 10 | if (0 !== strpos($expectedAlg, 'HS')) { |
|
| 22 | // not symmetric key |
||
| 23 | 2 | return null !== $kid |
|
| 24 | 1 | ? new JWKSet([$this->getIssuerJWKFromKid($issuer, $kid)]) |
|
| 25 | 2 | : $issuer->getJwks(); |
|
| 26 | } |
||
| 27 | |||
| 28 | 8 | $clientSecret = $metadata->getClientSecret(); |
|
| 29 | |||
| 30 | 8 | if (null === $clientSecret) { |
|
| 31 | throw new RuntimeException('Unable to verify token without client_secret'); |
||
| 32 | } |
||
| 33 | |||
| 34 | 8 | return new JWKSet([jose_secret_key($clientSecret)]); |
|
| 35 | } |
||
| 55 |