From 71fd790f9b1f222848eeabbc58b47893a64ed886 Mon Sep 17 00:00:00 2001 From: Andrea Lambicchi Date: Thu, 19 Aug 2021 11:05:21 +0200 Subject: [PATCH] fix cache expiration condition --- src/OpenIdVerificator.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/OpenIdVerificator.php b/src/OpenIdVerificator.php index 23e0f16..0cbcfe8 100644 --- a/src/OpenIdVerificator.php +++ b/src/OpenIdVerificator.php @@ -50,9 +50,9 @@ public function decodeOpenIdToken($openIdToken, $kid, $cache = true) public function getPublicKey($kid = null) { - if (Cache::has(self::V3_CERTS)) { - $v3Certs = Cache::get(self::V3_CERTS); - } else { + $v3Certs = Cache::get(self::V3_CERTS); + + if (is_null($v3Certs)) { $v3Certs = $this->getFreshCertificates(); Cache::put(self::V3_CERTS, $v3Certs, Carbon::now()->addSeconds($this->maxAge[self::URL_OPENID_CONFIG])); }