1
0

ICloudIdManager.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2017, Robin Appelman <robin@icewind.nl>
  5. *
  6. * @author Joas Schilling <coding@schilljs.com>
  7. * @author Robin Appelman <robin@icewind.nl>
  8. * @author Roeland Jago Douma <roeland@famdouma.nl>
  9. *
  10. * @license GNU AGPL version 3 or any later version
  11. *
  12. * This program is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License as
  14. * published by the Free Software Foundation, either version 3 of the
  15. * License, or (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  24. *
  25. */
  26. namespace OCP\Federation;
  27. /**
  28. * Interface for resolving federated cloud ids
  29. *
  30. * @since 12.0.0
  31. */
  32. interface ICloudIdManager {
  33. /**
  34. * @param string $cloudId
  35. * @return ICloudId
  36. * @throws \InvalidArgumentException
  37. *
  38. * @since 12.0.0
  39. */
  40. public function resolveCloudId(string $cloudId): ICloudId;
  41. /**
  42. * Get the cloud id for a remote user
  43. *
  44. * @param string $user
  45. * @param string|null $remote (optional since 23.0.0 for local users)
  46. * @return ICloudId
  47. *
  48. * @since 12.0.0
  49. */
  50. public function getCloudId(string $user, ?string $remote): ICloudId;
  51. /**
  52. * Check if the input is a correctly formatted cloud id
  53. *
  54. * @param string $cloudId
  55. * @return bool
  56. *
  57. * @since 12.0.0
  58. */
  59. public function isValidCloudId(string $cloudId): bool;
  60. /**
  61. * remove scheme/protocol from an url
  62. *
  63. * @param string $url
  64. * @param bool $httpsOnly
  65. *
  66. * @return string
  67. * @since 28.0.0
  68. * @since 30.0.0 - Optional parameter $httpsOnly was added
  69. */
  70. public function removeProtocolFromUrl(string $url, bool $httpsOnly = false): string;
  71. }