Skip to content

Commit 0ee87cc

Browse files
authored
feat: add setLeeway (#483)
* Add setLeeway * Update changelog
1 parent 7f27bab commit 0ee87cc

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [unreleased]
88

9+
### Added
10+
- Support to change the `leeway` time for JWT verification using `setLeeway` #483
11+
912
### Changed
1013
- Stop adding ?schema=openid to userinfo endpoint URL. #449
1114

src/OpenIDConnectClient.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2030,6 +2030,11 @@ public function getLeeway(): int
20302030
return $this->leeway;
20312031
}
20322032

2033+
public function setLeeway(int $leeway)
2034+
{
2035+
$this->leeway = $leeway;
2036+
}
2037+
20332038
/**
20342039
* @return string
20352040
*/

tests/OpenIDConnectClientTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,4 +338,15 @@ public function provideTestVerifyLogoutTokenClaimsData(): array
338338
],
339339
];
340340
}
341+
342+
public function testLeeway()
343+
{
344+
// Default leeway is 300
345+
$client = new OpenIDConnectClient();
346+
$this->assertEquals(300, $client->getLeeway());
347+
348+
// Set leeway to 100
349+
$client->setLeeway(100);
350+
$this->assertEquals(100, $client->getLeeway());
351+
}
341352
}

0 commit comments

Comments
 (0)