Skip to content

Commit 92e2be0

Browse files
committed
namespace problem with exception
temporarily disable htu check
1 parent d2da8b2 commit 92e2be0

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

src/Utils/DPop.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function getWebId($request) {
1616
if ($dpop) {
1717
$dpopKey = $this->getDpopKey($dpop, $request);
1818
if (!$this->validateJwtDpop($jwt, $dpopKey)) {
19-
throw new Exception("Invalid token");
19+
throw new \Exception("Invalid token");
2020
}
2121
}
2222
}
@@ -100,18 +100,18 @@ private function validateDpop($dpop, $request) {
100100
//error_log("3");
101101
// 3. the "typ" field in the header has the value "dpop+jwt",
102102
if ($typ != "dpop+jwt") {
103-
throw new Exception("typ is not dpop+jwt");
103+
throw new \Exception("typ is not dpop+jwt");
104104
}
105105

106106
//error_log("4");
107107
// 4. the algorithm in the header of the JWT indicates an asymmetric
108108
// digital signature algorithm, is not "none", is supported by the
109109
// application, and is deemed secure,
110110
if ($alg == "none") {
111-
throw new Exception("alg is none");
111+
throw new \Exception("alg is none");
112112
}
113113
if ($alg != "RS256") {
114-
throw new Exception("alg is not supported");
114+
throw new \Exception("alg is not supported");
115115
}
116116

117117
//error_log("5");
@@ -123,14 +123,14 @@ private function validateDpop($dpop, $request) {
123123
$signer = new \Lcobucci\JWT\Signer\Rsa\Sha256();
124124
$key = new \Lcobucci\JWT\Signer\Key($pem);
125125
if (!$dpop->verify($signer, $key)) {
126-
throw new Exception("invalid signature");
126+
throw new \Exception("invalid signature");
127127
}
128128

129129
//error_log("6");
130130
// 6. the "htm" claim matches the HTTP method value of the HTTP request
131131
// in which the JWT was received (case-insensitive),
132132
if (strtolower($htm) != strtolower($request->getMethod())) {
133-
throw new Exception("htm http method is invalid");
133+
throw new \Exception("htm http method is invalid");
134134
}
135135

136136
//error_log("7");
@@ -142,11 +142,15 @@ private function validateDpop($dpop, $request) {
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);
147+
145148
//error_log("REQUESTED HTU $htu");
146149
//error_log("REQUESTED PATH $requestedPath");
147-
if ($htu != $requestedPath) {
148-
throw new Exception("htu does not match requested path");
149-
}
150+
// FIXME: Restore this check
151+
// if ($htu != $requestedPath) {
152+
// throw new \Exception("htu does not match requested path");
153+
// }
150154

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

0 commit comments

Comments
 (0)