1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2026-01-03 23:42:28 +03:00

OIDC: Added extra userinfo content-type normalisation and test

During review of #5337
This commit is contained in:
Dan Brown
2024-11-28 16:58:06 +00:00
parent 17f7afe12d
commit bc1f1d92e5
2 changed files with 17 additions and 1 deletions

View File

@@ -11,7 +11,9 @@ class OidcUserinfoResponse implements ProvidesClaims
public function __construct(ResponseInterface $response, string $issuer, array $keys)
{
$contentType = explode(';', $response->getHeader('Content-Type')[0], 2)[0];
$contentTypeHeaderValue = $response->getHeader('Content-Type')[0] ?? '';
$contentType = strtolower(trim(explode(';', $contentTypeHeaderValue, 2)[0]));
if ($contentType === 'application/json') {
$this->claims = json_decode($response->getBody()->getContents(), true);
}