Skip to content

Commit

Permalink
Merge pull request #30 from jeremy379/revert-29-revert-27-dev/get-cla…
Browse files Browse the repository at this point in the history
…ims-with-scopes

Revert "Revert "Add scope filter to getClaims()""
  • Loading branch information
jeremy379 authored Sep 19, 2024
2 parents edd7d40 + 31420d7 commit b090623
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/Claims/Claimable.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
interface Claimable
{
/**
* @param string[] $scopes Optional scope filter
*
* @return string[]
*/
public function getClaims(): array;
public function getClaims(array $scopes = []): array;
}
4 changes: 3 additions & 1 deletion src/Claims/Traits/WithClaims.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 3 additions & 1 deletion src/Entities/IdentityEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/IdTokenResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit b090623

Please sign in to comment.