diff --git a/examples/src/Repositories/ScopeRepository.php b/examples/src/Repositories/ScopeRepository.php index fbd64b3e..f9879850 100644 --- a/examples/src/Repositories/ScopeRepository.php +++ b/examples/src/Repositories/ScopeRepository.php @@ -48,6 +48,13 @@ class ScopeRepository implements ScopeRepositoryInterface ClientEntityInterface $clientEntity, $userIdentifier = null ) { + // Example of programatically modifying the final scope of the access token + if ((int) $userIdentifier === 1) { + $scope = new ScopeEntity(); + $scope->setIdentifier('email'); + $scopes[] = $scope; + } + return $scopes; } } diff --git a/examples/src/Repositories/UserRepository.php b/examples/src/Repositories/UserRepository.php index 86f99970..88836cd6 100644 --- a/examples/src/Repositories/UserRepository.php +++ b/examples/src/Repositories/UserRepository.php @@ -11,7 +11,6 @@ namespace OAuth2ServerExamples\Repositories; use League\OAuth2\Server\Entities\ClientEntityInterface; use League\OAuth2\Server\Repositories\UserRepositoryInterface; -use OAuth2ServerExamples\Entities\ScopeEntity; use OAuth2ServerExamples\Entities\UserEntity; class UserRepository implements UserRepositoryInterface @@ -26,10 +25,6 @@ class UserRepository implements UserRepositoryInterface ClientEntityInterface $clientEntity ) { if ($username === 'alex' && $password === 'whisky') { - $scope = new ScopeEntity(); - $scope->setIdentifier('email'); - $scopes[] = $scope; - return new UserEntity(); }