Skip to content

Commit f9fbb9f

Browse files
authored
Parse content type on userInfo Response to allow charsets
1 parent 7f27bab commit f9fbb9f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/OpenIDConnectClient.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1277,8 +1277,11 @@ public function requestUserInfo(?string $attribute = null) {
12771277
throw new OpenIDConnectClientException('The communication to retrieve user data has failed with status code '.$this->getResponseCode());
12781278
}
12791279

1280+
// Extract the content type from the response (remove optional charset)
1281+
$contentType = explode(";",$this->getResponseContentType())[0];
1282+
12801283
// When we receive application/jwt, the UserInfo Response is signed and/or encrypted.
1281-
if ($this->getResponseContentType() === 'application/jwt' ) {
1284+
if ($contentType === 'application/jwt' ) {
12821285
// Check if the response is encrypted
12831286
$jwtHeaders = $this->decodeJWT($response);
12841287
if (isset($jwtHeaders->enc)) {

0 commit comments

Comments
 (0)