@@ -24,7 +24,7 @@ |
||
| 24 | 24 | int $expiresAt, ?string $requestedScope = null, ?string $redirectUri = null, |
| 25 | 25 | ?string $codeChallenge = null, ?string $codeChallengeMethod = null) |
| 26 | 26 | { |
| 27 | - parent::__construct($code, $scope, $clientIdentifier, $resourceOwnerIdentifier, $expiresAt, $requestedScope, $redirectUri); |
|
| 27 | + parent::__construct($code, $scope, $clientIdentifier, $resourceOwnerIdentifier, $expiresAt, $requestedScope, $redirectUri); |
|
| 28 | 28 | $this->codeChallenge = $codeChallenge; |
| 29 | 29 | $this->codeChallengeMethod = $codeChallengeMethod; |
| 30 | 30 | } |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | $supportedScopes = explode(' ', $client->getMetadata()->getScope()); |
| 60 | 60 | if (!empty(array_diff($scopes, $supportedScopes))) { |
| 61 | 61 | throw new OAuthException('invalid_scope', |
| 62 | - 'The request scope is invalid. Supported scopes : ' . $client->getMetadata()->getScope(), |
|
| 62 | + 'The request scope is invalid. Supported scopes : '.$client->getMetadata()->getScope(), |
|
| 63 | 63 | 'https://tools.ietf.org/html/rfc6749#section-4.1'); |
| 64 | 64 | } |
| 65 | 65 | } |
@@ -230,7 +230,7 @@ |
||
| 230 | 230 | |
| 231 | 231 | $this->redirectUri = $redirectUri; |
| 232 | 232 | } catch (\InvalidArgumentException $e) { |
| 233 | - throw new OAuthException('invalid_request', 'The request includes the malformed parameter redirect_uri. ' . $e->getMessage(), |
|
| 233 | + throw new OAuthException('invalid_request', 'The request includes the malformed parameter redirect_uri. '.$e->getMessage(), |
|
| 234 | 234 | 'https://tools.ietf.org/html/rfc6749#section-4.1'); |
| 235 | 235 | } |
| 236 | 236 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | |
| 26 | 26 | function getClaims() : array |
| 27 | 27 | { |
| 28 | - return $this->claims; |
|
| 28 | + return $this->claims; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
@@ -30,12 +30,12 @@ |
||
| 30 | 30 | { |
| 31 | 31 | $missingClaims = array_diff(self::REQUIRED_CLAIMS, array_keys($claims)); |
| 32 | 32 | if (!empty($missingClaims)) { |
| 33 | - throw new \Exception('Missing claims : ' . implode(', ', $missingClaims)); |
|
| 33 | + throw new \Exception('Missing claims : '.implode(', ', $missingClaims)); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | $undefinedClaims = array_diff(array_keys($claims), self::DEFINED_CLAIMS); |
| 37 | 37 | if (!empty($undefinedClaims)) { |
| 38 | - throw new \Exception('Undefined claims : ' . implode(', ', $undefinedClaims)); |
|
| 38 | + throw new \Exception('Undefined claims : '.implode(', ', $undefinedClaims)); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | // todo check nonce required if present in authentication request |
@@ -142,22 +142,22 @@ |
||
| 142 | 142 | function jsonSerialize() |
| 143 | 143 | { |
| 144 | 144 | $data = []; |
| 145 | - if($this->formatted) { |
|
| 145 | + if ($this->formatted) { |
|
| 146 | 146 | $data['formatted'] = $this->formatted; |
| 147 | 147 | } |
| 148 | - if($this->streetAddress) { |
|
| 148 | + if ($this->streetAddress) { |
|
| 149 | 149 | $data['street_address'] = $this->streetAddress; |
| 150 | 150 | } |
| 151 | - if($this->locality) { |
|
| 151 | + if ($this->locality) { |
|
| 152 | 152 | $data['locality'] = $this->locality; |
| 153 | 153 | } |
| 154 | - if($this->region) { |
|
| 154 | + if ($this->region) { |
|
| 155 | 155 | $data['region'] = $this->region; |
| 156 | 156 | } |
| 157 | - if($this->postalCode) { |
|
| 157 | + if ($this->postalCode) { |
|
| 158 | 158 | $data['postal_code'] = $this->postalCode; |
| 159 | 159 | } |
| 160 | - if($this->country) { |
|
| 160 | + if ($this->country) { |
|
| 161 | 161 | $data['country'] = $this->country; |
| 162 | 162 | } |
| 163 | 163 | return empty($data) ? '' : json_encode($data); |
@@ -445,7 +445,7 @@ |
||
| 445 | 445 | { |
| 446 | 446 | $getter = 'get'.ucfirst($this->snakeToCamel($offset)); |
| 447 | 447 | $result = $this->{$getter}(); |
| 448 | - if(is_object($result)) { |
|
| 448 | + if (is_object($result)) { |
|
| 449 | 449 | return json_encode($result); |
| 450 | 450 | } |
| 451 | 451 | return $result; |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | * @throws OAuthException |
| 64 | 64 | */ |
| 65 | 65 | public function verifyAuthorizationRequest(AuthorizationEndpoint $authorizationEndpoint, array $requestData) { |
| 66 | - if(empty($requestData['nonce'])) { |
|
| 66 | + if (empty($requestData['nonce'])) { |
|
| 67 | 67 | throw new OAuthException('invalid_request', 'Nonce required'); |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -124,11 +124,11 @@ discard block |
||
| 124 | 124 | return $this->resourceOwner->authenticate($this->prompt == self::PROMPT_SELECT_ACCOUNT, $this->loginHint); |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - if($this->idTokenHint) { |
|
| 127 | + if ($this->idTokenHint) { |
|
| 128 | 128 | //check if user associated to this id token is the current user. |
| 129 | - var_dump($this->idTokenHint['sub']);die; |
|
| 130 | - if($this->idTokenHint['sub'] !== $this->resourceOwner->getIdentifier()) { |
|
| 131 | - if($this->prompt == self::PROMPT_NONE) { |
|
| 129 | + var_dump($this->idTokenHint['sub']); die; |
|
| 130 | + if ($this->idTokenHint['sub'] !== $this->resourceOwner->getIdentifier()) { |
|
| 131 | + if ($this->prompt == self::PROMPT_NONE) { |
|
| 132 | 132 | throw new OAuthException('invalid_request'); |
| 133 | 133 | } |
| 134 | 134 | else { |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | $this->maxAge = empty($requestData['max_age']) ? null : $requestData['max_age']; |
| 195 | 195 | $this->uiLocales = empty($requestData['ui_locales']) ? null : explode(' ', $requestData['ui_locales']); |
| 196 | 196 | |
| 197 | - if(!empty($requestData['id_token_hint'])) { |
|
| 197 | + if (!empty($requestData['id_token_hint'])) { |
|
| 198 | 198 | try { |
| 199 | 199 | $this->idTokenHint = $this->idTokenManager->decode($requestData['id_token_hint']); |
| 200 | 200 | } catch (\Exception $exception) { |
@@ -130,8 +130,7 @@ |
||
| 130 | 130 | if($this->idTokenHint['sub'] !== $this->resourceOwner->getIdentifier()) { |
| 131 | 131 | if($this->prompt == self::PROMPT_NONE) { |
| 132 | 132 | throw new OAuthException('invalid_request'); |
| 133 | - } |
|
| 134 | - else { |
|
| 133 | + } else { |
|
| 135 | 134 | throw new OAuthException('login_required'); |
| 136 | 135 | } |
| 137 | 136 | } |