Skip to content

Commit

Permalink
Bump lcobucci/jwt to version 5 (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
youwe-petervanderwal committed Apr 11, 2024
1 parent e5e61df commit 93a7db2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"geoip2/geoip2": "^2.9",
"symfony/stopwatch": "^6.2",
"symfony/form": "^6.2",
"lcobucci/jwt": "^4.0",
"lcobucci/jwt": "^4.0 || ^5.0",
"matomo/device-detector": "^6.0",
"pimcore/newsletter-bundle": "^1.0",
"colinmollenhour/credis": "^1.10.0",
Expand Down
9 changes: 4 additions & 5 deletions src/Targeting/Storage/Cookie/JWTCookieSaveHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,18 @@ protected function createTokenBuilder(string $scope, string $name, \DateTimeInte
{
$time = new \DateTimeImmutable();

$builder = $this->config->builder();
$builder
$builder = $this->config->builder()
->issuedAt($time)
->withClaim(self::CLAIM_TARGETING_DATA, $data);

if (0 === $expire) {
$builder->expiresAt($time->modify('+30 minutes')); // expire in 30 min
$builder = $builder->expiresAt($time->modify('+30 minutes')); // expire in 30 min
} elseif (is_int($expire) && $expire > 0) {
$expire = new \DateTimeImmutable('@'. $expire);
$builder->expiresAt($expire);
$builder = $builder->expiresAt($expire);
} elseif ($expire instanceof \DateTimeInterface) {
$expire = new \DateTimeImmutable('@'. $expire->getTimestamp());
$builder->expiresAt($expire);
$builder = $builder->expiresAt($expire);
}

return $builder;
Expand Down

0 comments on commit 93a7db2

Please sign in to comment.