IProvider.php 955 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCP\Authentication\Token;
  8. use OCP\Authentication\Exceptions\ExpiredTokenException;
  9. use OCP\Authentication\Exceptions\InvalidTokenException;
  10. use OCP\Authentication\Exceptions\WipeTokenException;
  11. /**
  12. * @since 24.0.8
  13. */
  14. interface IProvider {
  15. /**
  16. * invalidates all tokens of a specific user
  17. * if a client name is given only tokens of that client will be invalidated
  18. *
  19. * @param string $uid
  20. * @param string|null $clientName
  21. * @since 24.0.8
  22. * @return void
  23. */
  24. public function invalidateTokensOfUser(string $uid, ?string $clientName);
  25. /**
  26. * Get a token by token string id
  27. *
  28. * @since 28.0.0
  29. * @throws InvalidTokenException
  30. * @throws ExpiredTokenException
  31. * @throws WipeTokenException
  32. * @return IToken
  33. */
  34. public function getToken(string $tokenId): IToken;
  35. }