Skip to content

Commit f01a65c

Browse files
committed
Add comments for possible problems to DPop class.
1 parent c1926c3 commit f01a65c

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/Utils/DPop.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,13 @@ public function getWebId($request) {
4040
$jwt = $auth[1] ?? false;
4141

4242
if (strtolower($auth[0]) == "dpop") {
43+
// @FIXME: What happens when HTTP_DPOP is not set?
4344
$dpop = $request->getServerParams()['HTTP_DPOP'];
4445
//@FIXME: check that there is just one DPoP token in the request
4546
if ($dpop) {
4647
$dpopKey = $this->getDpopKey($dpop, $request);
4748
try {
49+
// @FIXME: What happens when DPOP is not valid?
4850
$this->validateJwtDpop($jwt, $dpopKey);
4951
} catch (Lcobucci\JWT\Validation\RequiredConstraintsViolated $e) {
5052
throw new \Exception("Invalid token", $e);
@@ -82,14 +84,17 @@ public function getDpopKey($dpop, $request) {
8284
$dpop = $jwtConfig->parser()->parse($dpop);
8385
$jwk = $dpop->headers()->get("jwk");
8486

87+
// @FIXME: What happens when 'kid' is not set? 'Undefined array key "kid"'
8588
return $jwk['kid'];
8689
}
8790

8891
private function validateJwtDpop($jwt, $dpopKey) {
8992
$jwtConfig = $configuration = Configuration::forUnsecuredSigner();
9093
$jwt = $jwtConfig->parser()->parse($jwt);
94+
// @FIXME: What happens if CNF is not set?
9195
$cnf = $jwt->claims()->get("cnf");
9296

97+
// @FIXME: What happens if JKT is not set?
9398
if ($cnf['jkt'] == $dpopKey) {
9499
return true;
95100
}
@@ -234,6 +239,7 @@ private function getSubjectFromJwt($jwt) {
234239
throw new \Exception("Invalid JWT token", 409, $e);
235240
}
236241

242+
// @FIXME: What happens when "sub" is not provided?
237243
$sub = $jwt->claims()->get("sub");
238244
return $sub;
239245
}

0 commit comments

Comments
 (0)