Skip to content

Commit

Permalink
Allow setting the "exp" claim from event listeners
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximeMaillet authored and chalasr committed Oct 5, 2018
1 parent 8cbf97e commit e3a000f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Services/JWSProvider/DefaultJWSProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion Services/JWSProvider/LcobucciJWSProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit e3a000f

Please sign in to comment.