diff --git a/CHANGELOG.md b/CHANGELOG.md index 49ed0cb0b..3610ba7df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Changed (v9) - Authorization Request objects are now created through the factory method, `createAuthorizationRequest()` (PR #1111) +- Changed parameters for `finalizeScopes()` to allow a reference to an auth code ID (PR #1112) ### Changed - If an error is encountered when running `preg_match()` to validate an RSA key, the server will now throw a RuntimeException (PR #1047) diff --git a/src/Grant/AuthCodeGrant.php b/src/Grant/AuthCodeGrant.php index 914a8d62e..b6fe8824e 100644 --- a/src/Grant/AuthCodeGrant.php +++ b/src/Grant/AuthCodeGrant.php @@ -119,7 +119,8 @@ public function respondToAccessTokenRequest( $this->validateScopes($authCodePayload->scopes), $this->getIdentifier(), $client, - $authCodePayload->user_id + $authCodePayload->user_id, + $authCodePayload->auth_code_id ); } catch (LogicException $e) { throw OAuthServerException::invalidRequest('code', 'Cannot decrypt the authorization code', $e); diff --git a/src/Grant/PasswordGrant.php b/src/Grant/PasswordGrant.php index 7579fd0d2..cff5d40c3 100644 --- a/src/Grant/PasswordGrant.php +++ b/src/Grant/PasswordGrant.php @@ -53,8 +53,11 @@ public function respondToAccessTokenRequest( $scopes = $this->validateScopes($this->getRequestParameter('scope', $request, $this->defaultScope)); $user = $this->validateUser($request, $client); - // Finalize the requested scopes - $finalizedScopes = $this->scopeRepository->finalizeScopes($scopes, $this->getIdentifier(), $client, $user->getIdentifier()); + $finalizedScopes = $this->scopeRepository->finalizeScopes( + $scopes, + $this->getIdentifier(), + $client, + $user->getIdentifier()); // Issue and persist new access token $accessToken = $this->issueAccessToken($accessTokenTTL, $client, $user->getIdentifier(), $finalizedScopes); diff --git a/src/Repositories/ScopeRepositoryInterface.php b/src/Repositories/ScopeRepositoryInterface.php index 997aac2c8..9dbc0a896 100644 --- a/src/Repositories/ScopeRepositoryInterface.php +++ b/src/Repositories/ScopeRepositoryInterface.php @@ -34,6 +34,7 @@ public function getScopeEntityByIdentifier($identifier); * @param string $grantType * @param ClientEntityInterface $clientEntity * @param null|string $userIdentifier + * @param null|string $authCodeId * * @return ScopeEntityInterface[] */ @@ -41,6 +42,7 @@ public function finalizeScopes( array $scopes, $grantType, ClientEntityInterface $clientEntity, - $userIdentifier = null + $userIdentifier = null, + $authCodeId = null ); }