@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | { |
| 16 | 16 | private static function getKid(string $jwt): ?string |
| 17 | 17 | { |
| 18 | - if (! Str::is('*.*.*', $jwt)) { |
|
| 18 | + if (!Str::is('*.*.*', $jwt)) { |
|
| 19 | 19 | throw AuthException::auth(422, 'Malformed JWT'); |
| 20 | 20 | } |
| 21 | 21 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | private static function getClaims(string $jwt): ?object |
| 32 | 32 | { |
| 33 | - if (! Str::is('*.*.*', $jwt)) { |
|
| 33 | + if (!Str::is('*.*.*', $jwt)) { |
|
| 34 | 34 | throw AuthException::auth(422, 'Malformed JWT'); |
| 35 | 35 | } |
| 36 | 36 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | private static function jwkToPem(object $jwk): ?string |
| 44 | 44 | { |
| 45 | - if (! isset($jwk->e) || ! isset($jwk->n)) { |
|
| 45 | + if (!isset($jwk->e) || !isset($jwk->n)) { |
|
| 46 | 46 | throw AuthException::auth(500, 'Malformed jwk'); |
| 47 | 47 | } |
| 48 | 48 | |
@@ -63,13 +63,13 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | $response = Http::get($uri); |
| 65 | 65 | $json = $response->getBody(); |
| 66 | - if (! $json) { |
|
| 66 | + if (!$json) { |
|
| 67 | 67 | throw AuthException::auth(404, 'jwks endpoint not found'); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | $jwks = json_decode($json, false); |
| 71 | 71 | |
| 72 | - if (! $jwks || ! isset($jwks->keys) || ! is_array($jwks->keys)) { |
|
| 72 | + if (!$jwks || !isset($jwks->keys) || !is_array($jwks->keys)) { |
|
| 73 | 73 | throw AuthException::auth(404, 'No JWKs found'); |
| 74 | 74 | } |
| 75 | 75 | |
@@ -86,13 +86,13 @@ discard block |
||
| 86 | 86 | { |
| 87 | 87 | $response = Http::get($uri); |
| 88 | 88 | $json = $response->getBody(); |
| 89 | - if (! $json) { |
|
| 89 | + if (!$json) { |
|
| 90 | 90 | throw AuthException::auth(404, 'pem endpoint not found'); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | $pems = json_decode($json, false); |
| 94 | 94 | |
| 95 | - if (! $pems || ! isset($pems->publicKeys) || ! is_object($pems->publicKeys)) { |
|
| 95 | + if (!$pems || !isset($pems->publicKeys) || !is_object($pems->publicKeys)) { |
|
| 96 | 96 | throw AuthException::auth(404, 'pem not found'); |
| 97 | 97 | } |
| 98 | 98 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | private static function verifyToken(string $jwt, string $uri, bool $jwk = false): object |
| 109 | 109 | { |
| 110 | 110 | $kid = self::getKid($jwt); |
| 111 | - if (! $kid) { |
|
| 111 | + if (!$kid) { |
|
| 112 | 112 | throw AuthException::auth(422, 'Malformed JWT'); |
| 113 | 113 | } |
| 114 | 114 | |
@@ -127,12 +127,12 @@ discard block |
||
| 127 | 127 | ? self::getJwk($kid, $uri) |
| 128 | 128 | : self::getPem($kid, $uri); |
| 129 | 129 | |
| 130 | - if (! isset($publicKey) || ! $publicKey) { |
|
| 130 | + if (!isset($publicKey) || !$publicKey) { |
|
| 131 | 131 | throw AuthException::auth(500, 'Unable to validate JWT'); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (config('jwtauthroles.cache.enabled')) { |
| 135 | - if (config('jwtauthroles.cache.type') === 'database' && ! $row) { |
|
| 135 | + if (config('jwtauthroles.cache.type') === 'database' && !$row) { |
|
| 136 | 136 | JwtKey::create(['kid' => $kid, 'key' => $publicKey]); |
| 137 | 137 | } |
| 138 | 138 | } |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | ? config('jwtauthroles.jwkUri') |
| 149 | 149 | : config('jwtauthroles.pemUri'); |
| 150 | 150 | |
| 151 | - if (! config('jwtauthroles.validateJwt')) { |
|
| 151 | + if (!config('jwtauthroles.validateJwt')) { |
|
| 152 | 152 | $claims = self::getClaims($jwt); |
| 153 | 153 | } else { |
| 154 | 154 | $claims = self::verifyToken($jwt, $uri, config('jwtauthroles.useJwk')); |