Skip to content

Commit 3eabe48

Browse files
committed
Start to always validate common timestamps
1 parent 6934142 commit 3eabe48

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

src/Jws/ParsedJws.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public function __construct(
4242
protected readonly ClaimFactory $claimFactory,
4343
) {
4444
$this->validate();
45+
$this->validateCommonTimestamps();
4546
}
4647

4748

@@ -50,6 +51,16 @@ protected function validate(): void
5051
}
5152

5253

54+
protected function validateCommonTimestamps(): void
55+
{
56+
$this->validateByCallbacks(
57+
$this->getExpirationTime(...),
58+
$this->getNotBefore(...),
59+
$this->getIssuedAt(...),
60+
);
61+
}
62+
63+
5364
/**
5465
* @throws \SimpleSAML\OpenID\Exceptions\JwsException
5566
*/

tests/src/Jws/ParsedJwsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,8 @@ public function testCanGetEmptyPayload(): void
283283

284284
public function testThrowsOnPayloadDecodingError(): void
285285
{
286-
$this->jwsMock->expects($this->once())->method('getPayload')->willReturn('payload-json');
287-
$this->jsonHelperMock->expects($this->once())->method('decode')
286+
$this->jwsMock->expects($this->atLeastOnce())->method('getPayload')->willReturn('payload-json');
287+
$this->jsonHelperMock->expects($this->atLeastOnce())->method('decode')
288288
->willThrowException(new \JsonException('Error'));
289289

290290
$this->expectException(JwsException::class);

0 commit comments

Comments
 (0)