@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | ): void { |
| 46 | 46 | $idToken = $tokenSet->getIdToken(); |
| 47 | 47 | |
| 48 | - if (! $idToken) { |
|
| 48 | + if (!$idToken) { |
|
| 49 | 49 | throw new InvalidArgumentException('No id_token in token set'); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | $header = \json_decode(base64url_decode(\explode('.', $idToken)[0] ?? '{}'), true); |
| 57 | 57 | $payload = \json_decode(base64url_decode(\explode('.', $idToken)[1] ?? '{}'), true); |
| 58 | 58 | |
| 59 | - if (! \is_array($payload)) { |
|
| 59 | + if (!\is_array($payload)) { |
|
| 60 | 60 | throw new InvalidArgumentException('Unable to decode token payload'); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | if (\array_key_exists('s_hash', $payload)) { |
| 77 | 77 | $state = $authSession ? $authSession->getState() : null; |
| 78 | 78 | |
| 79 | - if (! $state) { |
|
| 79 | + if (!$state) { |
|
| 80 | 80 | throw new InvalidArgumentException('Cannot verify s_hash, "state" not provided'); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $metadata = $client->getMetadata(); |
| 56 | 56 | $expectedAlg = $metadata->getAuthorizationSignedResponseAlg(); |
| 57 | 57 | |
| 58 | - if (! $expectedAlg) { |
|
| 58 | + if (!$expectedAlg) { |
|
| 59 | 59 | throw new RuntimeException('No authorization_signed_response_alg defined'); |
| 60 | 60 | } |
| 61 | 61 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | $payload = \json_decode(base64url_decode(\explode('.', $token)[1] ?? '{}'), true); |
| 69 | 69 | |
| 70 | - if (! \is_array($payload)) { |
|
| 70 | + if (!\is_array($payload)) { |
|
| 71 | 71 | throw new InvalidArgumentException('Unable to decode token payload'); |
| 72 | 72 | } |
| 73 | 73 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | if (0 === \strpos($expectedAlg, 'HS')) { |
| 103 | 103 | $clientSecret = $metadata->getClientSecret(); |
| 104 | 104 | |
| 105 | - if (! $clientSecret) { |
|
| 105 | + if (!$clientSecret) { |
|
| 106 | 106 | throw new RuntimeException('Unable to verify token without client_secret'); |
| 107 | 107 | } |
| 108 | 108 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $jwks = $client->getIssuer()->getJwks(); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - if (! $jwsVerifier->verifyWithKeySet($jws, $jwks, 0)) { |
|
| 114 | + if (!$jwsVerifier->verifyWithKeySet($jws, $jwks, 0)) { |
|
| 115 | 115 | throw new InvalidArgumentException('Failed to validate JWT signature'); |
| 116 | 116 | } |
| 117 | 117 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
| 36 | 36 | { |
| 37 | - if (! \class_exists(Cookies::class)) { |
|
| 37 | + if (!\class_exists(Cookies::class)) { |
|
| 38 | 38 | throw new LogicException('To use the SessionCookieMiddleware you should install dflydev/fig-cookies package'); |
| 39 | 39 | } |
| 40 | 40 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $cookieValue = $sessionCookie ? $sessionCookie->getValue() : null; |
| 45 | 45 | $data = $cookieValue ? \json_decode($cookieValue, true) : []; |
| 46 | 46 | |
| 47 | - if (! \is_array($data)) { |
|
| 47 | + if (!\is_array($data)) { |
|
| 48 | 48 | $data = []; |
| 49 | 49 | } |
| 50 | 50 | |
@@ -45,11 +45,11 @@ |
||
| 45 | 45 | $client = $this->client ?: $request->getAttribute(ClientInterface::class); |
| 46 | 46 | $authSession = $request->getAttribute(AuthSessionInterface::class); |
| 47 | 47 | |
| 48 | - if (! $client instanceof ClientInterface) { |
|
| 48 | + if (!$client instanceof ClientInterface) { |
|
| 49 | 49 | throw new LogicException('No OpenID client provided'); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - if ($authSession && ! $client instanceof AuthSessionInterface) { |
|
| 52 | + if ($authSession && !$client instanceof AuthSessionInterface) { |
|
| 53 | 53 | throw new LogicException('Invalid auth session provided in attribute ' . AuthSessionInterface::class); |
| 54 | 54 | } |
| 55 | 55 | |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | { |
| 11 | 11 | $decoded = \base64_decode(\str_pad(\strtr($data, '-_', '+/'), \strlen($data) % 4, '=')); |
| 12 | 12 | |
| 13 | - if (! $decoded) { |
|
| 13 | + if (!$decoded) { |
|
| 14 | 14 | throw new RuntimeException('Unable to base64url_decode'); |
| 15 | 15 | } |
| 16 | 16 | |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | function check_server_response(ResponseInterface $response, ?int $expectedCode = null): void |
| 15 | 15 | { |
| 16 | - if (! $expectedCode && $response->getStatusCode() >= 400) { |
|
| 16 | + if (!$expectedCode && $response->getStatusCode() >= 400) { |
|
| 17 | 17 | throw OAuth2Exception::fromResponse($response); |
| 18 | 18 | } |
| 19 | 19 | |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | if ('POST' === $method) { |
| 20 | 20 | $params = $serverRequest->getParsedBody(); |
| 21 | 21 | |
| 22 | - if (! \is_array($params)) { |
|
| 22 | + if (!\is_array($params)) { |
|
| 23 | 23 | throw new RuntimeException('Invalid parsed body'); |
| 24 | 24 | } |
| 25 | 25 | |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | |
| 62 | 62 | $jwk = $this->jwk ?: $client->getJWKS()->selectKey('sig'); |
| 63 | 63 | |
| 64 | - if (! $jwk) { |
|
| 64 | + if (!$jwk) { |
|
| 65 | 65 | throw new RuntimeException('Unable to get a client signature jwk'); |
| 66 | 66 | } |
| 67 | 67 | |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | public function checkClaim($value): void |
| 30 | 30 | { |
| 31 | - if (! \is_int($value)) { |
|
| 31 | + if (!\is_int($value)) { |
|
| 32 | 32 | throw new InvalidClaimException('"auth_time" must be an integer.', self::CLAIM_NAME, $value); |
| 33 | 33 | } |
| 34 | 34 | |