diff options
Diffstat (limited to 'lib/private/Files/ObjectStore/SwiftV2CachingAuthService.php')
-rw-r--r-- | lib/private/Files/ObjectStore/SwiftV2CachingAuthService.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/private/Files/ObjectStore/SwiftV2CachingAuthService.php b/lib/private/Files/ObjectStore/SwiftV2CachingAuthService.php new file mode 100644 index 00000000000..266781af142 --- /dev/null +++ b/lib/private/Files/ObjectStore/SwiftV2CachingAuthService.php @@ -0,0 +1,24 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +namespace OC\Files\ObjectStore; + +use OpenStack\Common\Auth\Token; +use OpenStack\Identity\v2\Service; + +class SwiftV2CachingAuthService extends Service { + public function authenticate(array $options = []): array { + if (isset($options['v2cachedToken'], $options['v2serviceUrl']) + && $options['v2cachedToken'] instanceof Token + && is_string($options['v2serviceUrl'])) { + return [$options['v2cachedToken'], $options['v2serviceUrl']]; + } else { + return parent::authenticate($options); + } + } +} |