diff --git a/src/Claims/Claimable.php b/src/Claims/Claimable.php index e99632f..fc386d3 100644 --- a/src/Claims/Claimable.php +++ b/src/Claims/Claimable.php @@ -5,7 +5,9 @@ interface Claimable { /** + * @param string[] $scopes Optional scope filter + * * @return string[] */ - public function getClaims(): array; + public function getClaims(array $scopes = []): array; } diff --git a/src/Claims/Traits/WithClaims.php b/src/Claims/Traits/WithClaims.php index c539ed8..c9394c4 100644 --- a/src/Claims/Traits/WithClaims.php +++ b/src/Claims/Traits/WithClaims.php @@ -10,9 +10,11 @@ trait WithClaims protected array $claims; /** + * @param string[] $scopes Optional scope filter + * * @return string[] */ - public function getClaims(): array + public function getClaims(array $scopes = []): array { return $this->claims; } diff --git a/src/Entities/IdentityEntity.php b/src/Entities/IdentityEntity.php index 6e7fb9e..045d435 100644 --- a/src/Entities/IdentityEntity.php +++ b/src/Entities/IdentityEntity.php @@ -12,9 +12,11 @@ class IdentityEntity implements IdentityEntityInterface use WithClaims; /** + * @param string[] $scopes Optional scope filter + * * @return string[] */ - public function getClaims(): array + public function getClaims(array $scopes = []): array { /** * For a complete list of default claim sets diff --git a/src/IdTokenResponse.php b/src/IdTokenResponse.php index be61c98..4e10186 100644 --- a/src/IdTokenResponse.php +++ b/src/IdTokenResponse.php @@ -113,7 +113,7 @@ protected function getExtraParams(AccessTokenEntityInterface $accessToken): arra $claims = $this->claimExtractor->extract( $scopes, - $user->getClaims(), + $user->getClaims(explode(' ', $params['scope'])), ); foreach ($claims as $claimName => $claimValue) {