@@ -53,7 +53,7 @@ |
||
53 | 53 | if (!$this->scopePolicyManager->checkScope($client, $scope)) { |
54 | 54 | $supportedScopes = implode(', ', $this->scopePolicyManager->getSupportedScopes($client)); |
55 | 55 | throw new OAuthException('invalid_scope', |
56 | - 'Some of requested scopes are not supported. Scope supported : ' . $supportedScopes, |
|
56 | + 'Some of requested scopes are not supported. Scope supported : '.$supportedScopes, |
|
57 | 57 | 'https://tools.ietf.org/html/rfc6749#section-4.1'); |
58 | 58 | } |
59 | 59 |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | 'https://tools.ietf.org/html/rfc6749#section-5.2'); |
64 | 64 | } |
65 | 65 | |
66 | - $username= $request->getParsedBody()['username'] ?? ''; |
|
67 | - if(!$username) { |
|
66 | + $username = $request->getParsedBody()['username'] ?? ''; |
|
67 | + if (!$username) { |
|
68 | 68 | throw new OAuthException('invalid_request', 'Missing a required parameter : username', |
69 | 69 | 'https://tools.ietf.org/html/rfc6749#section-4.3'); |
70 | 70 | } |
71 | 71 | |
72 | - $password= $request->getParsedBody()['password'] ?? ''; |
|
73 | - if(!$password) { |
|
72 | + $password = $request->getParsedBody()['password'] ?? ''; |
|
73 | + if (!$password) { |
|
74 | 74 | throw new OAuthException('invalid_request', 'Missing a required parameter : password', |
75 | 75 | 'https://tools.ietf.org/html/rfc6749#section-4.3'); |
76 | 76 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | if (!$this->scopePolicyManager->checkScope($client, $scope)) { |
80 | 80 | $supportedScopes = implode(', ', $this->scopePolicyManager->getSupportedScopes($client)); |
81 | 81 | throw new OAuthException('invalid_scope', |
82 | - 'Some of requested scopes are not supported. Scope supported : ' . $supportedScopes, |
|
82 | + 'Some of requested scopes are not supported. Scope supported : '.$supportedScopes, |
|
83 | 83 | 'https://tools.ietf.org/html/rfc6749#section-4.1'); |
84 | 84 | } |
85 | 85 |
@@ -85,8 +85,7 @@ |
||
85 | 85 | |
86 | 86 | try { |
87 | 87 | $resourceOwner = $this->resourceOwnerProvider->authenticate($username, $password); |
88 | - } |
|
89 | - catch (\Exception $e) { |
|
88 | + } catch (\Exception $e) { |
|
90 | 89 | throw new OAuthException('invalid_grant', $e->getMessage(), |
91 | 90 | 'https://tools.ietf.org/html/rfc6749#section-4.3'); |
92 | 91 | } |
@@ -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 | } |