From f9fbb9f402d956d3dee8a825eabaa3daba0ec4bb Mon Sep 17 00:00:00 2001 From: Samuel Weirich <4281791+SamuelWei@users.noreply.github.com> Date: Tue, 6 May 2025 14:35:59 +0200 Subject: [PATCH 1/2] Parse content type on userInfo Response to allow charsets --- src/OpenIDConnectClient.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/OpenIDConnectClient.php b/src/OpenIDConnectClient.php index 32001612..2c3e04e1 100644 --- a/src/OpenIDConnectClient.php +++ b/src/OpenIDConnectClient.php @@ -1277,8 +1277,11 @@ public function requestUserInfo(?string $attribute = null) { throw new OpenIDConnectClientException('The communication to retrieve user data has failed with status code '.$this->getResponseCode()); } + // Extract the content type from the response (remove optional charset) + $contentType = explode(";",$this->getResponseContentType())[0]; + // When we receive application/jwt, the UserInfo Response is signed and/or encrypted. - if ($this->getResponseContentType() === 'application/jwt' ) { + if ($contentType === 'application/jwt' ) { // Check if the response is encrypted $jwtHeaders = $this->decodeJWT($response); if (isset($jwtHeaders->enc)) { From 2c990f13cfa5ad2fd19518d49ba1fb3ec4c92aa0 Mon Sep 17 00:00:00 2001 From: Samuel Weirich <4281791+SamuelWei@users.noreply.github.com> Date: Tue, 6 May 2025 14:38:32 +0200 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee24d509..a96c919e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Check existence of subject when verifying JWT #474 +- Signed and/or encrypted userInfo Responses with content type "application/jwt;charset=UTF-8" #479 ## [1.0.1] - 2024-09-13