Skip to content

Commit 1d1160e

Browse files
authored
Merge pull request #50 from pdsinterop/fix/htu-comparison
fix HTU comparison to skip fragments
2 parents 3674b86 + 211a613 commit 1d1160e

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/Utils/DPop.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -321,14 +321,16 @@ public function validateDpop($dpop, $request) {
321321
// 7. the "htu" claims matches the HTTP URI value for the HTTP request
322322
// in which the JWT was received, ignoring any query and fragment
323323
// parts,
324-
$requestedPath = (string)$request->getUri();
325-
$requestedPath = preg_replace("/[?#].*$/", "", $requestedPath);
326324

327-
//error_log("REQUESTED HTU $htu");
328-
//error_log("REQUESTED PATH $requestedPath");
329-
if ($htu != $requestedPath) {
330-
throw new InvalidTokenException("htu does not match requested path");
331-
}
325+
$requestedPath = (string)$request->getUri();
326+
$requestedPath = preg_replace("/[?#].*$/", "", $requestedPath);
327+
$htuClean = preg_replace("/[?#].*$/", "", $htu);
328+
// error_log("REQUESTED HTU $htu");
329+
// error_log("REQUESTED HTU cleaned $htuClean");
330+
// error_log("REQUESTED PATH $requestedPath");
331+
if ($htuClean != $requestedPath) {
332+
throw new InvalidTokenException("htu does not match requested path");
333+
}
332334

333335
// 8. the token was issued within an acceptable timeframe (see Section 9.1), and
334336

0 commit comments

Comments
 (0)