ICredentialsManager.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2016, ownCloud, Inc.
  5. *
  6. * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
  7. * @author J0WI <J0WI@users.noreply.github.com>
  8. * @author Robin McCorkell <robin@mccorkell.me.uk>
  9. *
  10. * @license AGPL-3.0
  11. *
  12. * This code is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License, version 3,
  14. * as published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License, version 3,
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>
  23. *
  24. */
  25. namespace OCP\Security;
  26. /**
  27. * Store and retrieve credentials for external services
  28. *
  29. * @since 8.2.0
  30. */
  31. interface ICredentialsManager {
  32. /**
  33. * Store a set of credentials
  34. *
  35. * @param string $userId empty string for system-wide credentials
  36. * @param string $identifier
  37. * @param mixed $credentials
  38. * @since 8.2.0
  39. */
  40. public function store(string $userId, string $identifier, $credentials): void;
  41. /**
  42. * Retrieve a set of credentials
  43. *
  44. * @param string $userId empty string for system-wide credentials
  45. * @param string $identifier
  46. * @return mixed
  47. * @since 8.2.0
  48. */
  49. public function retrieve(string $userId, string $identifier);
  50. /**
  51. * Delete a set of credentials
  52. *
  53. * @param string $userId empty string for system-wide credentials
  54. * @param string $identifier
  55. * @return int rows removed
  56. * @since 8.2.0
  57. */
  58. public function delete(string $userId, string $identifier): int;
  59. /**
  60. * Erase all credentials stored for a user
  61. *
  62. * @param string $userId
  63. * @return int rows removed
  64. * @since 8.2.0
  65. */
  66. public function erase(string $userId): int;
  67. }