Skip to content

Commit 70e3b8d

Browse files
mokemokechickenbshaffer
authored andcommitted
fix: Token Response's Content-Type to application/json
fix: at_hash digest computation('hash' function must be used with raw_output=true )
1 parent f6dcbba commit 70e3b8d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/OAuth2/Controller/TokenController.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ public function handleTokenRequest(RequestInterface $request, ResponseInterface
5151
// server MUST disable caching in headers when tokens are involved
5252
$response->setStatusCode(200);
5353
$response->addParameters($token);
54-
$response->addHttpHeaders(array('Cache-Control' => 'no-store', 'Pragma' => 'no-cache'));
54+
$response->addHttpHeaders(array(
55+
'Cache-Control' => 'no-store',
56+
'Pragma' => 'no-cache',
57+
'Content-Type' => 'application/json'
58+
));
5559
}
5660
}
5761

src/OAuth2/OpenID/ResponseType/IdToken.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ protected function createAtHash($access_token, $client_id = null)
8484
// maps HS256 and RS256 to sha256, etc.
8585
$algorithm = $this->publicKeyStorage->getEncryptionAlgorithm($client_id);
8686
$hash_algorithm = 'sha' . substr($algorithm, 2);
87-
$hash = hash($hash_algorithm, $access_token);
87+
$hash = hash($hash_algorithm, $access_token, true);
8888
$at_hash = substr($hash, 0, strlen($hash) / 2);
8989

9090
return $this->encryptionUtil->urlSafeB64Encode($at_hash);

0 commit comments

Comments
 (0)