From e5d599f7991d42628cf0b64c6dd41b2fbad4f816 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= <1005065+DeepDiver1975@users.noreply.github.com> Date: Mon, 2 Sep 2024 14:16:42 +0200 Subject: [PATCH 1/3] fix: do not spam log file when running in parallel with oauth app --- lib/Client.php | 22 ++++++++++++++++++++++ lib/OpenIdConnectAuthModule.php | 1 + 2 files changed, 23 insertions(+) diff --git a/lib/Client.php b/lib/Client.php index d8ce4ce..5ae7cc3 100644 --- a/lib/Client.php +++ b/lib/Client.php @@ -166,6 +166,14 @@ public function mode() { * @return object|null */ public function getAccessTokenPayload(): ?object { + if ($this->accessToken === '') { + return null; + } + $parts = explode('.', $this->accessToken); + if (!isset($parts[1])) { + return null; + } + return parent::getAccessTokenPayload(); } @@ -200,6 +208,9 @@ public function verifyToken(string $token) { } $introData = $this->introspectToken($token, '', $introspectionClientId, $introspectionClientSecret); + if ($introData === null) { + return null; + } $this->logger->debug('Introspection info: ' . \json_encode($introData, JSON_THROW_ON_ERROR)); if (\property_exists($introData, 'error')) { $this->logger->error('Token introspection failed: ' . \json_encode($introData, JSON_THROW_ON_ERROR)); @@ -212,6 +223,17 @@ public function verifyToken(string $token) { return $introData->exp; } + public function introspectToken($token, $token_type_hint = '', $clientId = null, $clientSecret = null) { + try { + # test if introspection is possible ... + $this->getProviderConfigValue('introspection_endpoint'); + } catch (OpenIDConnectClientException $e) { + return null; + } + + return parent::introspectToken($token, $token_type_hint, $clientId, $clientSecret); + } + /** * @throws OpenIDConnectClientException * @throws \JsonException diff --git a/lib/OpenIdConnectAuthModule.php b/lib/OpenIdConnectAuthModule.php index 3441e24..673c042 100644 --- a/lib/OpenIdConnectAuthModule.php +++ b/lib/OpenIdConnectAuthModule.php @@ -148,6 +148,7 @@ public function getUserPassword(IRequest $request): string { /** * @throws OpenIDConnectClientException + * @throws \JsonException */ private function verifyToken(string $token) { $cache = $this->getCache(); From 87f633f7c650936d4828dafc66f969c304b71d65 Mon Sep 17 00:00:00 2001 From: Juergen Weigert Date: Fri, 18 Oct 2024 16:20:54 +0200 Subject: [PATCH 2/3] build: prepare release 2.3.1 --- CHANGELOG.md | 8 ++++++-- appinfo/info.xml | 2 +- sonar-project.properties | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8d9e92..4d492d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). -## [Unreleased] - XXXX-xx-xx +## [2.3.1] - 2024-10-17 +### Fixed + +- [#319](https://github.com/owncloud/openidconnect/pull/319) - fix: do not spam log file when running in parallel with oauth app ## [2.3.0] - 2024-07-10 @@ -106,7 +109,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Initial Release -[Unreleased]: https://github.com/owncloud/openidconnect/compare/v2.3.0...master +[Unreleased]: https://github.com/owncloud/openidconnect/compare/v2.3.1...master +[2.3.1]: https://github.com/owncloud/openidconnect/compare/v2.3.0...v2.3.1 [2.3.0]: https://github.com/owncloud/openidconnect/compare/v2.2.0...v2.3.0 [2.2.0]: https://github.com/owncloud/openidconnect/compare/v2.1.1...v2.2.0 [2.1.1]: https://github.com/owncloud/openidconnect/compare/v2.1.0...v2.1.1 diff --git a/appinfo/info.xml b/appinfo/info.xml index e3995b3..6721676 100755 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -19,7 +19,7 @@ The integration requires an Identity Provider that supports OpenID Connect (e.g. More information on setup, configuration and migration can be found in the ownCloud Documentation. GPLv2 Thomas Müller - 2.3.0 + 2.3.1 OpenIdConnect integration diff --git a/sonar-project.properties b/sonar-project.properties index cda4cac..10090b7 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,7 +1,7 @@ # Organization and project keys are displayed in the right sidebar of the project homepage sonar.organization=owncloud-1 sonar.projectKey=owncloud_openidconnect -sonar.projectVersion=2.3.0 +sonar.projectVersion=2.3.1 sonar.host.url=https://sonarcloud.io # ===================================================== From 4f3a25c885214442dd13c74d8828d4f5f655f2e0 Mon Sep 17 00:00:00 2001 From: Juergen Weigert Date: Fri, 18 Oct 2024 16:31:29 +0200 Subject: [PATCH 3/3] build: prepare merge back --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d492d1..790890c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). +## [Unreleased] - XXXX-XX-XX + + ## [2.3.1] - 2024-10-17 ### Fixed - [#319](https://github.com/owncloud/openidconnect/pull/319) - fix: do not spam log file when running in parallel with oauth app + ## [2.3.0] - 2024-07-10 ### Added