Skip to content

Commit 8f9961a

Browse files
committed
Change TokenGenerator::generateIdToken() to make the $dpopKey parameter required.
1 parent 13a6ed7 commit 8f9961a

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

src/TokenGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function generateRegistrationAccessToken($clientId, $privateKey) {
4444
return $token->toString();
4545
}
4646

47-
public function generateIdToken($accessToken, $clientId, $subject, $nonce, $privateKey, $dpopKey=null) {
47+
public function generateIdToken($accessToken, $clientId, $subject, $nonce, $privateKey, $dpopKey) {
4848
$issuer = $this->config->getServer()->get(OidcMeta::ISSUER);
4949

5050
$jwks = $this->getJwks();

tests/unit/TokenGeneratorTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,26 @@ final public function testIdTokenGenerationWithoutPrivateKey(): void
254254
);
255255
}
256256

257+
/**
258+
* @testdox Token Generator SHOULD complain WHEN asked to generate a IdToken without dpopKey
259+
*
260+
* @covers ::generateIdToken
261+
*/
262+
final public function testIdTokenGenerationWithoutDpopKey(): void
263+
{
264+
$tokenGenerator = $this->createTokenGenerator();
265+
266+
$this->expectArgumentCountError(6);
267+
268+
$tokenGenerator->generateIdToken(
269+
'mock access token',
270+
'mock clientId',
271+
'mock subject',
272+
'mock nonce',
273+
'mock private key'
274+
);
275+
}
276+
257277
/**
258278
* @testdox Token Generator SHOULD return a IdToken WHEN asked to generate a IdToken with clientId and privateKey
259279
*

0 commit comments

Comments
 (0)