Skip to content
Snippets Groups Projects
Unverified Commit d6dea09f authored by Morris Jobke's avatar Morris Jobke Committed by GitHub
Browse files

Merge pull request #9323 from nextcloud/backport/9322/swift-v3

[swift]  Better swift V3 token handling 
parents e0e687f2 1dd71930
Branches
Tags
No related merge requests found
......@@ -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');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment