Skip to content

Commit 0988e33

Browse files
committed
restore htu validation
1 parent e6c9ce7 commit 0988e33

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

src/Utils/DPop.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,20 +137,17 @@ private function validateDpop($dpop, $request) {
137137
// 7. the "htu" claims matches the HTTP URI value for the HTTP request
138138
// in which the JWT was received, ignoring any query and fragment
139139
// parts,
140-
$requestedPath = $request->getServerParams()['REQUEST_SCHEME'] . "://" . $request->getServerParams()['SERVER_NAME'] . $request->getRequestTarget();
140+
$requestedPath = (string)$request->getUri();
141141
$requestedPath = preg_replace("/[?#].*$/", "", $requestedPath);
142142
// FIXME: Remove this; it was disabled for testing with a server running on 443 internally but accessible on :444
143143
$htu = str_replace(":444", "", $htu);
144144
$requestedPath = str_replace(":444", "", $requestedPath);
145-
$htu = str_replace("http://", "https://", $htu);
146-
$requestedPath = str_replace("http://", "https://", $requestedPath);
147145

148146
//error_log("REQUESTED HTU $htu");
149147
//error_log("REQUESTED PATH $requestedPath");
150-
// FIXME: Restore this check
151-
// if ($htu != $requestedPath) {
152-
// throw new \Exception("htu does not match requested path");
153-
// }
148+
if ($htu != $requestedPath) {
149+
throw new \Exception("htu does not match requested path");
150+
}
154151

155152
//error_log("8");
156153
// 8. the token was issued within an acceptable timeframe (see Section 9.1), and

0 commit comments

Comments
 (0)