From a1e379986bdb737f2a2d0f643404a8ca0335c344 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Thu, 26 Apr 2018 20:47:47 +0200 Subject: [PATCH 1/2] json_decode an associative array for the swift cached token Signed-off-by: Roeland Jago Douma --- lib/private/Files/ObjectStore/SwiftFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/Files/ObjectStore/SwiftFactory.php b/lib/private/Files/ObjectStore/SwiftFactory.php index caa4774daba..62dfcb448d2 100644 --- a/lib/private/Files/ObjectStore/SwiftFactory.php +++ b/lib/private/Files/ObjectStore/SwiftFactory.php @@ -56,7 +56,7 @@ class SwiftFactory { private function getCachedToken(string $cacheKey) { $cachedTokenString = $this->cache->get($cacheKey . '/token'); if ($cachedTokenString) { - return json_decode($cachedTokenString); + return json_decode($cachedTokenString, true); } else { return null; } From 1dd71930472cd257674d780326ce31116ac2caff Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Thu, 26 Apr 2018 20:51:05 +0200 Subject: [PATCH 2/2] generateTokenFromCache is only valid for V3 Signed-off-by: Roeland Jago Douma --- lib/private/Files/ObjectStore/SwiftFactory.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/private/Files/ObjectStore/SwiftFactory.php b/lib/private/Files/ObjectStore/SwiftFactory.php index 62dfcb448d2..b817aac0299 100644 --- a/lib/private/Files/ObjectStore/SwiftFactory.php +++ b/lib/private/Files/ObjectStore/SwiftFactory.php @@ -131,9 +131,9 @@ class SwiftFactory { $cachedToken = $this->params['cachedToken']; $hasValidCachedToken = false; - if (is_array($cachedToken)) { + if (\is_array($cachedToken) && ($authService instanceof IdentityV3Service)) { $token = $authService->generateTokenFromCache($cachedToken); - if (is_null($token->catalog)) { + if (\is_null($token->catalog)) { $this->logger->warning('Invalid cached token for swift, no catalog set: ' . json_encode($cachedToken)); } else if ($token->hasExpired()) { $this->logger->debug('Cached token for swift expired');