Skip to content

Commit

Permalink
fix(mercure): prevent float for exp claim
Browse files Browse the repository at this point in the history
  • Loading branch information
Grafikart committed Nov 1, 2024
1 parent d821d44 commit 5ad9dcd
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,11 @@ public function setMercureCookie(ResponseEvent $event): void
// On n'utilise pas la méthode createCookie d'authorization car elle utiliserait la clef secrète publisher
// On part du clear cookie, pour le modifier et utiliser la clef d'abonnement.
$cookie = $this->authorization->createClearCookie($request, null)
->withExpires(0)
->withValue($this->tokenFactory->create($channels, null));
->withExpires($exp)
->withValue($this->tokenFactory->create($channels, null, [
// We need to set a date without ms to avoid float in "exp"
'exp' => new \DateTimeImmutable("@" . $exp->getTimestamp()),
]));
$response->headers->setCookie($cookie);
}
}

0 comments on commit 5ad9dcd

Please sign in to comment.