@@ -73,7 +73,7 @@ |
||
| 73 | 73 | |
| 74 | 74 | $this->authorizationCodeStorage->revoke($authorizationCode->getCode()); |
| 75 | 75 | |
| 76 | - if($authorizationCode->getExpiresAt() < time()) { |
|
| 76 | + if ($authorizationCode->getExpiresAt() < time()) { |
|
| 77 | 77 | throw new OAuthException('invalid_grant', 'Authorization code has expired', |
| 78 | 78 | 'https://tools.ietf.org/html/rfc6749#section-4.1.3'); |
| 79 | 79 | } |
@@ -96,11 +96,11 @@ |
||
| 96 | 96 | * @throws \Exception |
| 97 | 97 | */ |
| 98 | 98 | public function validate() { |
| 99 | - if(!$this->responseType) { |
|
| 99 | + if (!$this->responseType) { |
|
| 100 | 100 | throw new \Exception('Missing response_type parameter'); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - if(!$this->clientId) { |
|
| 103 | + if (!$this->clientId) { |
|
| 104 | 104 | throw new \Exception('Missing client_id parameter'); |
| 105 | 105 | } |
| 106 | 106 | return true; |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - if(!$state && $this->configurationRepository->getConfig(Config::ENFORCE_STATE)) { |
|
| 65 | + if (!$state && $this->configurationRepository->getConfig(Config::ENFORCE_STATE)) { |
|
| 66 | 66 | throw new OAuthException('invalid_request', |
| 67 | 67 | 'Missing a required parameter : state', |
| 68 | 68 | 'http://openid.net/specs/openid-connect-core-1_0.html#AuthorizationEndpoint' |
@@ -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 |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | /** |
| 39 | 39 | * @var RegisteredClient $client |
| 40 | 40 | */ |
| 41 | - if($res = $this->verify($request, $result)) { |
|
| 41 | + if ($res = $this->verify($request, $result)) { |
|
| 42 | 42 | return $res; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | $result = []; |
| 57 | 57 | |
| 58 | 58 | try { |
| 59 | - if(!$resourceOwner->isConsentGivenForClient($client)) { |
|
| 59 | + if (!$resourceOwner->isConsentGivenForClient($client)) { |
|
| 60 | 60 | throw new OAuthException('access_denied', |
| 61 | 61 | 'The resource owner server denied the request', |
| 62 | 62 | 'https://tools.ietf.org/html/rfc6749#section-4.1.1'); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @var ResponseTypeInterface $responseType |
| 69 | 69 | */ |
| 70 | 70 | foreach ($responseTypes as $responseType) { |
| 71 | - if($responseType->getExtendedResponseTypes()) { |
|
| 71 | + if ($responseType->getExtendedResponseTypes()) { |
|
| 72 | 72 | $extendedResponseTypes = array_merge($extendedResponseTypes, $responseType->getExtendedResponseTypes()); |
| 73 | 73 | } |
| 74 | 74 | $responseTypeNames[] = $responseType->getResponseType(); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * @var ResponseTypeInterface $responseType |
| 79 | 79 | */ |
| 80 | 80 | foreach ($responseTypes as $responseType) { |
| 81 | - if(!in_array($responseType->getResponseType(), $extendedResponseTypes)) { |
|
| 81 | + if (!in_array($responseType->getResponseType(), $extendedResponseTypes)) { |
|
| 82 | 82 | $extendedResponseTypes = null; |
| 83 | 83 | if ($responseType->getExtendedResponseTypes()) { |
| 84 | 84 | $extendedResponseTypeNames = array_intersect($responseType->getExtendedResponseTypes(), array_keys($responseTypes)); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $data['state'] ?? null); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - if(isset($data['state'])) { |
|
| 101 | + if (isset($data['state'])) { |
|
| 102 | 102 | $result['state'] = $data['state']; |
| 103 | 103 | } |
| 104 | 104 | |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | if (!$scopePolicyManager->checkScope($client, $scope)) { |
| 259 | 259 | $supportedScopes = implode(', ', $scopePolicyManager->getSupportedScopes($client)); |
| 260 | 260 | throw new OAuthException('invalid_scope', |
| 261 | - 'Some of requested scopes are not supported. Scope supported : ' . $supportedScopes, |
|
| 261 | + 'Some of requested scopes are not supported. Scope supported : '.$supportedScopes, |
|
| 262 | 262 | 'https://tools.ietf.org/html/rfc6749#section-4.1'); |
| 263 | 263 | } |
| 264 | 264 | |
@@ -417,12 +417,12 @@ discard block |
||
| 417 | 417 | $responseType = $this->server->getResponseTypeRepository()->getResponseType($responseTypeName); |
| 418 | 418 | if (!$responseType) { |
| 419 | 419 | throw new OAuthException('invalid_request', |
| 420 | - 'Unknown response_type : ' . $responseTypeName); |
|
| 420 | + 'Unknown response_type : '.$responseTypeName); |
|
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | if (!$responseType->isMultiValuedResponseTypeSupported()) { |
| 424 | 424 | throw new OAuthException('invalid_request', |
| 425 | - 'Multi-valued response_type not supported with response_type : ' . $responseTypeName); |
|
| 425 | + 'Multi-valued response_type not supported with response_type : '.$responseTypeName); |
|
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | $responseTypes[$responseTypeName] = $responseType; |
@@ -73,25 +73,25 @@ discard block |
||
| 73 | 73 | ]; |
| 74 | 74 | |
| 75 | 75 | // todo, include if auth_time is marked as an essential claim by the client otherwise it is optional (conf ?) |
| 76 | - if(isset($data['max_age']) && $data['max_age']) { |
|
| 76 | + if (isset($data['max_age']) && $data['max_age']) { |
|
| 77 | 77 | $claims['auth_time'] = $resourceOwner->getTimeWhenAuthenticationOccured(); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - if(isset($data['nonce']) && !is_null($data['nonce'])) { |
|
| 80 | + if (isset($data['nonce']) && !is_null($data['nonce'])) { |
|
| 81 | 81 | $claims['nonce'] = $data['nonce']; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - if(empty($extendedResponseTypes)) { |
|
| 84 | + if (empty($extendedResponseTypes)) { |
|
| 85 | 85 | $standardClaims = $this->userInfoClaimsStorage->getClaims($resourceOwner); |
| 86 | 86 | |
| 87 | 87 | foreach ($this->userInfoClaimsStorage->getClaimsByScope($scope) as $claimRequested) { |
| 88 | - if(isset($standardClaims[$claimRequested]) && $standardClaims[$claimRequested]) { |
|
| 88 | + if (isset($standardClaims[$claimRequested]) && $standardClaims[$claimRequested]) { |
|
| 89 | 89 | $claims[$claimRequested] = $standardClaims[$claimRequested]; |
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - if(isset($extendedResponseTypes['code'])) { |
|
| 94 | + if (isset($extendedResponseTypes['code'])) { |
|
| 95 | 95 | //c_hash |
| 96 | 96 | /** |
| 97 | 97 | * @var \OAuth2\ResponseTypes\ResponseTypeInterface $responseType |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $claims['c_hash'] = 'todo'; //todo |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - if(isset($extendedResponseTypes['token'])) { |
|
| 105 | + if (isset($extendedResponseTypes['token'])) { |
|
| 106 | 106 | //at_hash |
| 107 | 107 | /** |
| 108 | 108 | * @var \OAuth2\ResponseTypes\ResponseTypeInterface $responseType |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | $certsRepository = $this->sqlOauth->getRepository(Cert::class); |
| 47 | 47 | |
| 48 | 48 | $actualCerts = $certsRepository->findBy([], ['createdAt' => 'DESC'], 2); |
| 49 | - if(!isset($actualCerts[0])) { |
|
| 49 | + if (!isset($actualCerts[0])) { |
|
| 50 | 50 | list('privKey' => $privKey, 'pubKey' => $pubKey, 'rsa' => $rsa) = $this->generateRSAKeys(); |
| 51 | 51 | |
| 52 | 52 | $oldCert = new Cert(); |
@@ -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; |