Merge pull request #9322 from nextcloud/bugfix/noid/swift_token_cache

Better swift V3 token handling
This commit is contained in:
Morris Jobke 2018-04-27 13:51:44 +02:00 committed by GitHub
commit 21da3594f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -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');