@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $links = $data['links'] ?? []; |
| 64 | 64 | $href = null; |
| 65 | 65 | foreach ($links as $link) { |
| 66 | - if (! \is_array($link)) { |
|
| 66 | + if (!\is_array($link)) { |
|
| 67 | 67 | continue; |
| 68 | 68 | } |
| 69 | 69 | |
@@ -71,14 +71,14 @@ discard block |
||
| 71 | 71 | continue; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - if (! \array_key_exists('href', $link)) { |
|
| 74 | + if (!\array_key_exists('href', $link)) { |
|
| 75 | 75 | continue; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | $href = $link['href']; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if (! \is_string($href) || 0 !== \strpos($href, 'https://')) { |
|
| 81 | + if (!\is_string($href) || 0 !== \strpos($href, 'https://')) { |
|
| 82 | 82 | throw new InvalidArgumentException('Invalid issuer location'); |
| 83 | 83 | } |
| 84 | 84 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | throw new RuntimeException('Unable to fetch provider metadata', 0, $e); |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - if (! \array_key_exists('issuer', $data)) { |
|
| 131 | + if (!\array_key_exists('issuer', $data)) { |
|
| 132 | 132 | throw new RuntimeException('Invalid metadata content, no "issuer" key found'); |
| 133 | 133 | } |
| 134 | 134 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | ? $metadata->getUserinfoSignedResponseAlg() |
| 84 | 84 | : $metadata->getIdTokenSignedResponseAlg(); |
| 85 | 85 | |
| 86 | - if (! $expectedAlg) { |
|
| 86 | + if (!$expectedAlg) { |
|
| 87 | 87 | throw new RuntimeException('Unable to verify id_token without an alg value'); |
| 88 | 88 | } |
| 89 | 89 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | $payload = \json_decode(base64url_decode(\explode('.', $idToken)[1] ?? '{}'), true); |
| 97 | 97 | |
| 98 | - if (! \is_array($payload)) { |
|
| 98 | + if (!\is_array($payload)) { |
|
| 99 | 99 | throw new InvalidArgumentException('Unable to decode token payload'); |
| 100 | 100 | } |
| 101 | 101 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | $requiredClaims = []; |
| 122 | 122 | |
| 123 | - if (! $fromUserInfo) { |
|
| 123 | + if (!$fromUserInfo) { |
|
| 124 | 124 | $requiredClaims = ['iss', 'sub', 'aud', 'exp', 'iat']; |
| 125 | 125 | } |
| 126 | 126 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | if (0 === \strpos($expectedAlg, 'HS')) { |
| 147 | 147 | $clientSecret = $metadata->getClientSecret(); |
| 148 | 148 | |
| 149 | - if (! $clientSecret) { |
|
| 149 | + if (!$clientSecret) { |
|
| 150 | 150 | throw new RuntimeException('Unable to verify token without client_secret'); |
| 151 | 151 | } |
| 152 | 152 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $jwks = $client->getIssuer()->getJwks(); |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - if (! $jwsVerifier->verifyWithKeySet($jws, $jwks, 0)) { |
|
| 158 | + if (!$jwsVerifier->verifyWithKeySet($jws, $jwks, 0)) { |
|
| 159 | 159 | throw new InvalidArgumentException('Failed to validate JWT signature'); |
| 160 | 160 | } |
| 161 | 161 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | 'code_verifier' => $this->codeVerifier, |
| 129 | 129 | ]; |
| 130 | 130 | |
| 131 | - return \array_filter($data, static function ($value) { |
|
| 131 | + return \array_filter($data, static function($value) { |
|
| 132 | 132 | return null !== $value; |
| 133 | 133 | }); |
| 134 | 134 | } |
@@ -138,13 +138,13 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | public function claims(): array |
| 140 | 140 | { |
| 141 | - if (! $this->idToken) { |
|
| 141 | + if (!$this->idToken) { |
|
| 142 | 142 | throw new RuntimeException('Unable to retrieve claims without an id_token'); |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | $data = \json_decode(base64url_decode(\explode('.', $this->idToken)[1] ?? ''), true); |
| 146 | 146 | |
| 147 | - if (! \is_array($data)) { |
|
| 147 | + if (!\is_array($data)) { |
|
| 148 | 148 | throw new RuntimeException('Unable to decode id_token payload'); |
| 149 | 149 | } |
| 150 | 150 | |
@@ -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 | |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | $expectedAlg = $metadata->get($use . '_encrypted_response_alg'); |
| 39 | 39 | $expectedEnc = $metadata->get($use . '_encrypted_response_enc'); |
| 40 | 40 | |
| 41 | - if (! $expectedAlg) { |
|
| 41 | + if (!$expectedAlg) { |
|
| 42 | 42 | return $token; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -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 | |
@@ -37,17 +37,17 @@ |
||
| 37 | 37 | $tokenSet = $request->getAttribute(TokenSetInterface::class); |
| 38 | 38 | $client = $this->client ?: $request->getAttribute(ClientInterface::class); |
| 39 | 39 | |
| 40 | - if (! $client instanceof ClientInterface) { |
|
| 40 | + if (!$client instanceof ClientInterface) { |
|
| 41 | 41 | throw new LogicException('No OpenID client provided'); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - if (! $tokenSet instanceof TokenSetInterface) { |
|
| 44 | + if (!$tokenSet instanceof TokenSetInterface) { |
|
| 45 | 45 | throw new RuntimeException('Unable to get token response attribute'); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | $accessToken = $tokenSet->getAccessToken(); |
| 49 | 49 | |
| 50 | - if (! $accessToken) { |
|
| 50 | + if (!$accessToken) { |
|
| 51 | 51 | throw new RuntimeException(\sprintf( |
| 52 | 52 | 'Unable to get access token from "%s" attribute', |
| 53 | 53 | TokenSetInterface::class |