1
0

SwiftV2CachingAuthService.php 659 B

123456789101112131415161718192021222324
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OC\Files\ObjectStore;
  8. use OpenStack\Common\Auth\Token;
  9. use OpenStack\Identity\v2\Service;
  10. class SwiftV2CachingAuthService extends Service {
  11. public function authenticate(array $options = []): array {
  12. if (isset($options['v2cachedToken'], $options['v2serviceUrl'])
  13. && $options['v2cachedToken'] instanceof Token
  14. && is_string($options['v2serviceUrl'])) {
  15. return [$options['v2cachedToken'], $options['v2serviceUrl']];
  16. } else {
  17. return parent::authenticate($options);
  18. }
  19. }
  20. }