1
0

ICredentialsManager.php 1.8 KB

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