@@ -65,18 +65,18 @@ discard block |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | $refreshToken = $request->getParsedBody()['refresh_token'] ?? ''; |
68 | - if(!$refreshToken) { |
|
68 | + if (!$refreshToken) { |
|
69 | 69 | throw new OAuthException('invalid_request', 'Missing a required parameter : refresh_token', |
70 | 70 | 'https://tools.ietf.org/html/rfc6749#section-4.3'); |
71 | 71 | } |
72 | 72 | |
73 | 73 | $refreshToken = $this->refreshTokenStorage->get($refreshToken); |
74 | - if(!$refreshToken || $refreshToken->getClientId() !== $client->getIdentifier()) { |
|
74 | + if (!$refreshToken || $refreshToken->getClientId() !== $client->getIdentifier()) { |
|
75 | 75 | throw new OAuthException('invalid_grant', 'Refresh token is invalid', |
76 | 76 | 'https://tools.ietf.org/html/rfc6749#section-4.3'); |
77 | 77 | } |
78 | 78 | |
79 | - if(!is_null($refreshToken->getExpiresAt()) && $refreshToken->getExpiresAt() < time()) { |
|
79 | + if (!is_null($refreshToken->getExpiresAt()) && $refreshToken->getExpiresAt() < time()) { |
|
80 | 80 | $this->refreshTokenStorage->revoke($refreshToken->getToken()); |
81 | 81 | |
82 | 82 | throw new OAuthException('invalid_grant', 'Refresh token has expired', |
@@ -84,16 +84,16 @@ discard block |
||
84 | 84 | } |
85 | 85 | |
86 | 86 | $includedScopes = isset($request->getParsedBody()['scope']) ? explode(' ', $request->getParsedBody()['scope']) : null; |
87 | - if(is_array($includedScopes) && !empty(array_diff($includedScopes, explode(' ', $refreshToken->getToken())))) { |
|
87 | + if (is_array($includedScopes) && !empty(array_diff($includedScopes, explode(' ', $refreshToken->getToken())))) { |
|
88 | 88 | throw new OAuthException('invalid_scope', |
89 | - 'Some of scope included are not granted for this token. Scope granted : ' . $refreshToken->getScope(), |
|
89 | + 'Some of scope included are not granted for this token. Scope granted : '.$refreshToken->getScope(), |
|
90 | 90 | 'https://tools.ietf.org/html/rfc6749#section-6'); |
91 | 91 | } |
92 | 92 | |
93 | 93 | // issue an access token token and, optionally, a refresh token |
94 | 94 | $accessToken = $this->accessTokenStorage->create($client->getIdentifier(), $refreshToken->getUserId(), $refreshToken->getScope()); |
95 | 95 | $newRefreshToken = null; |
96 | - if($this->configurationRepository->getConfig(Config::REGENERATE_REFRESH_TOKENS_AFTER_USE)) { |
|
96 | + if ($this->configurationRepository->getConfig(Config::REGENERATE_REFRESH_TOKENS_AFTER_USE)) { |
|
97 | 97 | $this->refreshTokenStorage->revoke($refreshToken->getToken()); |
98 | 98 | $newRefreshToken = $this->refreshTokenStorage->create( |
99 | 99 | $refreshToken->getClientId(), $refreshToken->getUserId(), $refreshToken->getScope())->getToken(); |
@@ -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' |
@@ -37,12 +37,12 @@ |
||
37 | 37 | { |
38 | 38 | $claims = []; |
39 | 39 | |
40 | - if(isset($extendedResponseTypes['code'])) { |
|
40 | + if (isset($extendedResponseTypes['code'])) { |
|
41 | 41 | //c_hash |
42 | 42 | $code = $extendedResponseTypes['code']->handle()['code']; |
43 | 43 | $result['code'] = $code; |
44 | 44 | } |
45 | - if(isset($extendedResponseTypes['token'])) { |
|
45 | + if (isset($extendedResponseTypes['token'])) { |
|
46 | 46 | //at_hash |
47 | 47 | $token = $extendedResponseTypes['token']->handle()['token']; |
48 | 48 | $result['token'] = $token; |
@@ -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; |