File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -166,17 +166,18 @@ public function makeJwkThumbprint($jwk) {
166166 public function validateJwtDpop ($ jwt , $ dpop , $ request ) {
167167 $ this ->validateDpop ($ dpop , $ request );
168168 $ jwtConfig = Configuration::forUnsecuredSigner ();
169- $ jwtConfig ->parser ()->parse ($ dpop );
170-
171- /**
172- * @FIXME: ATH claim is not yet supported/required by the Solid OIDC specification.
173- * Once the Solid spec catches up to the DPOP spec, not having an ATH is incorrect.
174- * At that point, instead of returning "true", throw an exception:
175- *
176- * @see https://github.com/pdsinterop/php-solid-auth/issues/34
177- */
178- // throw new InvalidTokenException('DPoP "ath" claim is missing');
179- return true ;
169+ $ dpopJWT = $ jwtConfig ->parser ()->parse ($ dpop );
170+
171+ $ ath = $ dpopJWT ->claims ()->get ('ath ' );
172+
173+ if ($ ath === null ) {
174+ throw new InvalidTokenException ('DPoP "ath" claim is missing ' );
175+ }
176+
177+ $ hash = hash ('sha256 ' , $ jwt );
178+ $ encoded = Base64Url::encode ($ hash );
179+
180+ return ($ ath === $ encoded );
180181 }
181182
182183 /**
You can’t perform that action at this time.
0 commit comments