allowedTimeDrift = $allowedTimeDrift; $this->protectedHeaderOnly = $protectedHeaderOnly; } /** * {@inheritdoc} * * @throws InvalidClaimException if the claim is invalid */ public function checkClaim($value): void { if (!is_float($value) && !is_int($value)) { throw new InvalidClaimException('"iat" must be an integer.', self::NAME, $value); } if (time() < $value - $this->allowedTimeDrift) { throw new InvalidClaimException('The JWT is issued in the future.', self::NAME, $value); } } public function supportedClaim(): string { return self::NAME; } /** * @param mixed $value * * @throws InvalidHeaderException if the header parameter is invalid */ public function checkHeader($value): void { if (!is_float($value) && !is_int($value)) { throw new InvalidHeaderException('The header "iat" must be an integer.', self::NAME, $value); } if (time() < $value - $this->allowedTimeDrift) { throw new InvalidHeaderException('The JWT is issued in the future.', self::NAME, $value); } } public function supportedHeader(): string { return self::NAME; } public function protectedHeaderOnly(): bool { return $this->protectedHeaderOnly; } }