File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed
Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -87,18 +87,20 @@ public function getWebId($request) {
8787 * @throws RequiredConstraintsViolated
8888 */
8989 public function getDpopKey ($ dpop , $ request ) {
90+ $ kid = '' ;
91+
9092 $ this ->validateDpop ($ dpop , $ request );
9193
9294 // 1. the string value is a well-formed JWT,
9395 $ jwtConfig = Configuration::forUnsecuredSigner ();
9496 $ dpop = $ jwtConfig ->parser ()->parse ($ dpop );
9597 $ jwk = $ dpop ->headers ()->get ("jwk " );
9698
97- if (isset ($ jwk ['kid ' ]) === false ) {
98- throw new InvalidTokenException ( ' Key ID is missing from JWK header ' ) ;
99+ if (isset ($ jwk ['kid ' ])) {
100+ $ kid = $ jwk [ ' kid ' ] ;
99101 }
100102
101- return $ jwk [ ' kid ' ] ;
103+ return $ kid ;
102104 }
103105
104106 private function validateJwtDpop ($ jwt , $ dpopKey ) {
Original file line number Diff line number Diff line change @@ -311,7 +311,7 @@ final public function testGetWebIdWithoutDpop(): void
311311 }
312312
313313 /**
314- * @testdox Dpop SHOULD complain WHEN asked to get WebId from Request with valid DPOP without JWT Key Id
314+ * @testdox Dpop SHOULD return given "sub" WHEN asked to get WebId from Request with valid DPOP without JWT Key Id
315315 *
316316 * @covers ::getWebId
317317 *
@@ -340,10 +340,10 @@ final public function testGetWebIdWithDpopWithoutKeyId(): void
340340 'HTTP_DPOP ' => $ token ['token ' ],
341341 ),array (), $ this ->url );
342342
343- $ this -> expectException (InvalidTokenException::class );
344- $ this -> expectExceptionMessage ( ' Key ID is missing from JWK header ' ) ;
343+ $ actual = $ dpop -> getWebId ( $ request );
344+ $ expected = ' mock sub ' ;
345345
346- $ dpop -> getWebId ( $ request );
346+ $ this -> assertEquals ( $ expected , $ actual );
347347 }
348348
349349 /**
You can’t perform that action at this time.
0 commit comments