Skip to content

Commit 10dc732

Browse files
authored
Merge pull request #28 from itk-dev/feature/unique-token-keys-for-oidcs-providers
Generate and use unique token keys across OIDC providers
2 parents 8f91566 + 2e58fe9 commit 10dc732

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
88

99
## [Unreleased]
1010

11+
## [2.5.0] 2026-07-14
12+
13+
* Use unique token keys for OIDC providers.
14+
1115
## [2.4.1] 2026-04-21
1216

1317
* Fetched providers as array when displaying them.
@@ -49,7 +53,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
4953

5054
* Allowed multiple providers.
5155

52-
[Unreleased]: https://github.com/itk-dev/os2forms_nemlogin_openid_connect/compare/2.4.1...HEAD
56+
[Unreleased]: https://github.com/itk-dev/os2forms_nemlogin_openid_connect/compare/2.5.0...HEAD
57+
[2.5.0]: https://github.com/itk-dev/os2forms_nemlogin_openid_connect/compare/2.4.1...2.5.0
5358
[2.4.1]: https://github.com/itk-dev/os2forms_nemlogin_openid_connect/compare/2.4.0...2.4.1
5459
[2.4.0]: https://github.com/itk-dev/os2forms_nemlogin_openid_connect/compare/2.3.1...2.4.0
5560
[2.3.1]: https://github.com/itk-dev/os2forms_nemlogin_openid_connect/compare/2.3.0...2.3.1

src/Plugin/os2web/NemloginAuthProvider/OpenIDConnect.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ public function logout() {
239239
* @phpstan-param array<string, mixed> $token
240240
*/
241241
public function setToken(array $token): self {
242-
$this->session->set(self::SESSION_TOKEN, $token);
242+
$this->session->set($this->getTokenKey(), $token);
243243

244244
return $this;
245245
}
@@ -250,9 +250,10 @@ public function setToken(array $token): self {
250250
* @phpstan-return array<string, mixed>|null
251251
*/
252252
private function getToken(bool $clear = FALSE): ?array {
253-
$token = $this->session->get(self::SESSION_TOKEN);
253+
$tokenKey = $this->getTokenKey();
254+
$token = $this->session->get($tokenKey);
254255
if ($clear) {
255-
$this->session->remove(self::SESSION_TOKEN);
256+
$this->session->remove($tokenKey);
256257
}
257258

258259
return $token;
@@ -535,4 +536,11 @@ private function getClaimKeys(): array {
535536
return $keys;
536537
}
537538

539+
/**
540+
* Get unique token key.
541+
*/
542+
private function getTokenKey(): string {
543+
return self::SESSION_TOKEN . '_' . $this->getPluginId();
544+
}
545+
538546
}

0 commit comments

Comments
 (0)