Skip to content

Commit

Permalink
Set expiration timestamp in authorization records
Browse files Browse the repository at this point in the history
Related to #15
  • Loading branch information
robertlemke committed Nov 10, 2020
1 parent d273d48 commit f795813
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Classes/Authorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit f795813

Please sign in to comment.