/** * {@inheritdoc} */ public function checkJWT(JWTInterface $jwt) { if (!$jwt->hasProtectedHeader('crit')) { return; } $crit = $jwt->getProtectedHeader('crit'); if (!is_array($crit)) { throw new \RuntimeException('The header "crit" must contain an array'); } foreach ($crit as $critical) { if (!$jwt->hasHeaderOrClaim($critical)) { throw new \Exception(sprintf("The claim/header '%s' is marked as critical but value is not set.", $critical)); } } }