ICredentialsManager.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  6. * SPDX-License-Identifier: AGPL-3.0-only
  7. */
  8. namespace OCP\Security;
  9. /**
  10. * Store and retrieve credentials for external services
  11. *
  12. * @since 8.2.0
  13. */
  14. interface ICredentialsManager {
  15. /**
  16. * Store a set of credentials
  17. *
  18. * @param string $userId empty string for system-wide credentials
  19. * @param string $identifier
  20. * @param mixed $credentials
  21. * @since 8.2.0
  22. */
  23. public function store(string $userId, string $identifier, $credentials): void;
  24. /**
  25. * Retrieve a set of credentials
  26. *
  27. * @param string $userId empty string for system-wide credentials
  28. * @param string $identifier
  29. * @return mixed
  30. * @since 8.2.0
  31. */
  32. public function retrieve(string $userId, string $identifier);
  33. /**
  34. * Delete a set of credentials
  35. *
  36. * @param string $userId empty string for system-wide credentials
  37. * @param string $identifier
  38. * @return int rows removed
  39. * @since 8.2.0
  40. */
  41. public function delete(string $userId, string $identifier): int;
  42. /**
  43. * Erase all credentials stored for a user
  44. *
  45. * @param string $userId
  46. * @return int rows removed
  47. * @since 8.2.0
  48. */
  49. public function erase(string $userId): int;
  50. }