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 f0e476d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Services/JWSProvider/DefaultJWSProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ public function create(array $payload, array $header = [])
$jws = new JWS($header, $this->cryptoEngine);
$claims = ['iat' => time()];

if (null !== $this->ttl) {
$claims['exp'] = time() + $this->ttl;
if (null !== $this->ttl && !isset($payload['exp'])) {
$payload['exp'] = time() + $this->ttl;
}

$jws->setPayload($payload + $claims);
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 f0e476d

Please sign in to comment.