Skip to content

Commit

Permalink
feature #503 Allow setting the "exp" claim from event listeners (Maxi…
Browse files Browse the repository at this point in the history
…meMaillet)

This PR was merged into the 2.x-dev branch.

Discussion
----------

Allow setting the "exp" claim from event listeners

Related in [#441](#441)

Commits
-------

e3a000f Allow setting the "exp" claim from event listeners
  • Loading branch information
chalasr committed Oct 6, 2018
2 parents 8cbf97e + e3a000f commit 4dfe7fd
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 4dfe7fd

Please sign in to comment.