From f795813ec5895b5c7f021783d1cd6ddfd0b0bda4 Mon Sep 17 00:00:00 2001 From: Robert Lemke Date: Tue, 10 Nov 2020 09:44:55 +0100 Subject: [PATCH] Set expiration timestamp in authorization records Related to #15 --- Classes/Authorization.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Classes/Authorization.php b/Classes/Authorization.php index 3bb8b0c..f06f32b 100644 --- a/Classes/Authorization.php +++ b/Classes/Authorization.php @@ -228,6 +228,11 @@ public function setEncryptedSerializedAccessToken(string $encryptedSerializedAcc */ public function setAccessToken(AccessTokenInterface $accessToken): void { + $expirationTimestamp = $accessToken->getExpires(); + if ($expirationTimestamp) { + $this->setExpires(\DateTimeImmutable::createFromFormat('U', (string)$expirationTimestamp)); + } + try { if ($this->encryptionService !== null && $this->encryptionService->isConfigured()) { $this->encryptedSerializedAccessToken = $this->encryptionService->encryptAndEncode(json_encode($accessToken, JSON_THROW_ON_ERROR, 512));