diff --git a/Services/JWSProvider/DefaultJWSProvider.php b/Services/JWSProvider/DefaultJWSProvider.php index 70b2ec72..99ab6d67 100644 --- a/Services/JWSProvider/DefaultJWSProvider.php +++ b/Services/JWSProvider/DefaultJWSProvider.php @@ -89,7 +89,7 @@ public function create(array $payload, array $header = []) $jws = new JWS($header, $this->cryptoEngine); $claims = ['iat' => time()]; - if (null !== $this->ttl) { + if (null !== $this->ttl && !isset($payload['exp'])) { $claims['exp'] = time() + $this->ttl; } diff --git a/Services/JWSProvider/LcobucciJWSProvider.php b/Services/JWSProvider/LcobucciJWSProvider.php index 64cbc42f..d52cb9a1 100644 --- a/Services/JWSProvider/LcobucciJWSProvider.php +++ b/Services/JWSProvider/LcobucciJWSProvider.php @@ -80,7 +80,7 @@ public function create(array $payload, array $header = []) } $jws->setIssuedAt(time()); - if (null !== $this->ttl) { + if (null !== $this->ttl && !isset($payload['exp'])) { $jws->setExpiration(time() + $this->ttl); }