@@ -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 |
@@ -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 |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | unset($params[$key]); |
99 | 99 | } elseif ('claims' === $key && (\is_array($value) || $value instanceof JsonSerializable)) { |
100 | 100 | $params['claims'] = \json_encode($value); |
101 | - } elseif (! \is_string($value)) { |
|
101 | + } elseif (!\is_string($value)) { |
|
102 | 102 | $params[$key] = (string) $value; |
103 | 103 | } |
104 | 104 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | $this->tokenSetVerifier->validate($tokenSet, $client, $authSession, true, $maxAge); |
133 | 133 | } |
134 | 134 | |
135 | - if (! $tokenSet->getCode()) { |
|
135 | + if (!$tokenSet->getCode()) { |
|
136 | 136 | return $tokenSet; |
137 | 137 | } |
138 | 138 | |
@@ -149,15 +149,15 @@ discard block |
||
149 | 149 | ): TokenSetInterface { |
150 | 150 | $code = $tokenSet->getCode(); |
151 | 151 | |
152 | - if (! $code) { |
|
152 | + if (!$code) { |
|
153 | 153 | throw new RuntimeException('Unable to fetch token without a code'); |
154 | 154 | } |
155 | 155 | |
156 | - if (! $redirectUri) { |
|
156 | + if (!$redirectUri) { |
|
157 | 157 | $redirectUri = $client->getMetadata()->getRedirectUris()[0] ?? null; |
158 | 158 | } |
159 | 159 | |
160 | - if (! $redirectUri) { |
|
160 | + if (!$redirectUri) { |
|
161 | 161 | throw new InvalidArgumentException('A redirect_uri should be provided'); |
162 | 162 | } |
163 | 163 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | 'redirect_uri' => $redirectUri, |
168 | 168 | ]); |
169 | 169 | |
170 | - if (! ($params['id_token'] ?? null)) { |
|
170 | + if (!($params['id_token'] ?? null)) { |
|
171 | 171 | return TokenSet::fromParams($params); |
172 | 172 | } |
173 | 173 |