aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-04-26 22:55:58 +0200
committerGitHub <noreply@github.com>2018-04-26 22:55:58 +0200
commitd6dea09f48ced38d50712375f0cfa8211f56c391 (patch)
tree60e81c632492a44abd63dc66d1715507440afa1d
parente0e687f2a7d15062b6bb80cba4009787bbe91cc7 (diff)
parent1dd71930472cd257674d780326ce31116ac2caff (diff)
downloadnextcloud-server-d6dea09f48ced38d50712375f0cfa8211f56c391.tar.gz
nextcloud-server-d6dea09f48ced38d50712375f0cfa8211f56c391.zip
Merge pull request #9323 from nextcloud/backport/9322/swift-v3
[swift] Better swift V3 token handling
-rw-r--r--lib/private/Files/ObjectStore/SwiftFactory.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/private/Files/ObjectStore/SwiftFactory.php b/lib/private/Files/ObjectStore/SwiftFactory.php
index caa4774daba..b817aac0299 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;
}
@@ -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');