Skip to content

Commit 62f505a

Browse files
authored
Merge pull request #56 from DarthLegiON/kid
Added kid header in id token
2 parents 0d67b5a + 255f34e commit 62f505a

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

src/IdTokenResponse.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,19 @@ class IdTokenResponse extends BearerTokenResponse
3030
*/
3131
protected $claimExtractor;
3232

33+
/**
34+
* @var string|null
35+
*/
36+
protected $keyIdentifier;
37+
3338
public function __construct(
3439
IdentityProviderInterface $identityProvider,
35-
ClaimExtractor $claimExtractor
40+
ClaimExtractor $claimExtractor,
41+
?string $keyIdentifier = null
3642
) {
3743
$this->identityProvider = $identityProvider;
3844
$this->claimExtractor = $claimExtractor;
45+
$this->keyIdentifier = $keyIdentifier;
3946
}
4047

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

97+
if ($this->keyIdentifier !== null) {
98+
$builder = $builder->withHeader('kid', $keyIdentifier);
99+
}
100+
90101
if (
91102
method_exists($this->privateKey, 'getKeyContents')
92103
&& !empty($this->privateKey->getKeyContents())

0 commit comments

Comments
 (0)