Skip to content

Commit

Permalink
Merge pull request #56 from DarthLegiON/kid
Browse files Browse the repository at this point in the history
Added kid header in id token
  • Loading branch information
steverhoades authored Sep 24, 2024
2 parents 0d67b5a + 255f34e commit 62f505a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/IdTokenResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,19 @@ class IdTokenResponse extends BearerTokenResponse
*/
protected $claimExtractor;

/**
* @var string|null
*/
protected $keyIdentifier;

public function __construct(
IdentityProviderInterface $identityProvider,
ClaimExtractor $claimExtractor
ClaimExtractor $claimExtractor,
?string $keyIdentifier = null
) {
$this->identityProvider = $identityProvider;
$this->claimExtractor = $claimExtractor;
$this->keyIdentifier = $keyIdentifier;
}

protected function getBuilder(AccessTokenEntityInterface $accessToken, UserEntityInterface $userEntity)
Expand Down Expand Up @@ -87,6 +94,10 @@ protected function getExtraParams(AccessTokenEntityInterface $accessToken): arra
$builder = $builder->withClaim($claimName, $claimValue);
}

if ($this->keyIdentifier !== null) {
$builder = $builder->withHeader('kid', $keyIdentifier);
}

if (
method_exists($this->privateKey, 'getKeyContents')
&& !empty($this->privateKey->getKeyContents())
Expand Down

0 comments on commit 62f505a

Please sign in to comment.