aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/Federation
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public/Federation')
-rw-r--r--lib/public/Federation/Events/TrustedServerRemovedEvent.php33
-rw-r--r--lib/public/Federation/Exceptions/ActionNotSupportedException.php28
-rw-r--r--lib/public/Federation/Exceptions/AuthenticationFailedException.php28
-rw-r--r--lib/public/Federation/Exceptions/BadRequestException.php35
-rw-r--r--lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php30
-rw-r--r--lib/public/Federation/Exceptions/ProviderCouldNotAddShareException.php28
-rw-r--r--lib/public/Federation/Exceptions/ProviderDoesNotExistsException.php28
-rw-r--r--lib/public/Federation/ICloudFederationFactory.php24
-rw-r--r--lib/public/Federation/ICloudFederationNotification.php28
-rw-r--r--lib/public/Federation/ICloudFederationProvider.php27
-rw-r--r--lib/public/Federation/ICloudFederationProviderManager.php49
-rw-r--r--lib/public/Federation/ICloudFederationShare.php24
-rw-r--r--lib/public/Federation/ICloudId.php23
-rw-r--r--lib/public/Federation/ICloudIdManager.php67
-rw-r--r--lib/public/Federation/ICloudIdResolver.php40
15 files changed, 194 insertions, 298 deletions
diff --git a/lib/public/Federation/Events/TrustedServerRemovedEvent.php b/lib/public/Federation/Events/TrustedServerRemovedEvent.php
new file mode 100644
index 00000000000..41899d67a88
--- /dev/null
+++ b/lib/public/Federation/Events/TrustedServerRemovedEvent.php
@@ -0,0 +1,33 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Federation\Events;
+
+use OCP\EventDispatcher\Event;
+
+/**
+ * @since 25.0.0
+ */
+class TrustedServerRemovedEvent extends Event {
+ private string $urlHash;
+
+ /**
+ * @since 25.0.0
+ */
+ public function __construct(string $urlHash) {
+ parent::__construct();
+ $this->urlHash = $urlHash;
+ }
+
+ /**
+ * @since 25.0.0
+ */
+ public function getUrlHash(): string {
+ return $this->urlHash;
+ }
+}
diff --git a/lib/public/Federation/Exceptions/ActionNotSupportedException.php b/lib/public/Federation/Exceptions/ActionNotSupportedException.php
index df54ce22f97..7f0e0f46907 100644
--- a/lib/public/Federation/Exceptions/ActionNotSupportedException.php
+++ b/lib/public/Federation/Exceptions/ActionNotSupportedException.php
@@ -1,29 +1,12 @@
<?php
+
/**
- * @copyright Copyright (c) 2018 Bjoern Schiessle <bjoern@schiessle.org>
- *
- * @author Bjoern Schiessle <bjoern@schiessle.org>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCP\Federation\Exceptions;
-use OC\HintException;
+use OCP\HintException;
/**
* Class ActionNotSupportedException
@@ -32,7 +15,6 @@ use OC\HintException;
* @since 14.0.0
*/
class ActionNotSupportedException extends HintException {
-
/**
* ActionNotSupportedException constructor.
*
@@ -40,7 +22,7 @@ class ActionNotSupportedException extends HintException {
*
*/
public function __construct($action) {
- $l = \OC::$server->getL10N('federation');
+ $l = \OCP\Util::getL10N('federation');
$message = 'Action "' . $action . '" not supported or implemented.';
$hint = $l->t('Action "%s" not supported or implemented.', [$action]);
parent::__construct($message, $hint);
diff --git a/lib/public/Federation/Exceptions/AuthenticationFailedException.php b/lib/public/Federation/Exceptions/AuthenticationFailedException.php
index 5ddac52c130..6ce5314844e 100644
--- a/lib/public/Federation/Exceptions/AuthenticationFailedException.php
+++ b/lib/public/Federation/Exceptions/AuthenticationFailedException.php
@@ -1,29 +1,12 @@
<?php
+
/**
- * @copyright Copyright (c) 2018 Bjoern Schiessle <bjoern@schiessle.org>
- *
- * @author Bjoern Schiessle <bjoern@schiessle.org>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCP\Federation\Exceptions;
-use OC\HintException;
+use OCP\HintException;
/**
* Class AuthenticationFailedException
@@ -32,7 +15,6 @@ use OC\HintException;
* @since 14.0.0
*/
class AuthenticationFailedException extends HintException {
-
/**
* BadRequestException constructor.
*
@@ -40,7 +22,7 @@ class AuthenticationFailedException extends HintException {
*
*/
public function __construct() {
- $l = \OC::$server->getL10N('federation');
+ $l = \OCP\Util::getL10N('federation');
$message = 'Authentication failed, wrong token or provider ID given';
$hint = $l->t('Authentication failed, wrong token or provider ID given');
parent::__construct($message, $hint);
diff --git a/lib/public/Federation/Exceptions/BadRequestException.php b/lib/public/Federation/Exceptions/BadRequestException.php
index 850f84f1e90..0210437a8d5 100644
--- a/lib/public/Federation/Exceptions/BadRequestException.php
+++ b/lib/public/Federation/Exceptions/BadRequestException.php
@@ -1,30 +1,12 @@
<?php
+
/**
- * @copyright Copyright (c) 2018 Bjoern Schiessle <bjoern@schiessle.org>
- *
- * @author Bjoern Schiessle <bjoern@schiessle.org>
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCP\Federation\Exceptions;
-use OC\HintException;
+use OCP\HintException;
/**
* Class BadRequestException
@@ -33,6 +15,9 @@ use OC\HintException;
* @since 14.0.0
*/
class BadRequestException extends HintException {
+ /**
+ * @var string[] $parameterList
+ */
private $parameterList;
/**
@@ -43,7 +28,7 @@ class BadRequestException extends HintException {
* @param array $missingParameters
*/
public function __construct(array $missingParameters) {
- $l = \OC::$server->getL10N('federation');
+ $l = \OCP\Util::getL10N('federation');
$this->parameterList = $missingParameters;
$parameterList = implode(',', $missingParameters);
$message = 'Parameters missing in order to complete the request. Missing Parameters: ' . $parameterList;
@@ -56,7 +41,7 @@ class BadRequestException extends HintException {
*
* @since 14.0.0
*
- * @return array
+ * @return array{message: string, validationErrors: array{message: string, name: string}[]}
*/
public function getReturnMessage() {
$result = [
@@ -66,7 +51,7 @@ class BadRequestException extends HintException {
];
foreach ($this->parameterList as $missingParameter) {
- $result['validationErrors'] = [
+ $result['validationErrors'][] = [
'name' => $missingParameter,
'message' => 'NOT_FOUND'
];
diff --git a/lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php b/lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php
index e7e1d859db0..f753f5f3326 100644
--- a/lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php
+++ b/lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php
@@ -1,31 +1,12 @@
<?php
+
/**
- * @copyright Copyright (c) 2018 Bjoern Schiessle <bjoern@schiessle.org>
- *
- * @author Bjoern Schiessle <bjoern@schiessle.org>
- * @author Joas Schilling <coding@schilljs.com>
- * @author rakekniven <mark.ziegler@rakekniven.de>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCP\Federation\Exceptions;
-use OC\HintException;
+use OCP\HintException;
/**
* Class ProviderAlreadyExistsException
@@ -34,7 +15,6 @@ use OC\HintException;
* @since 14.0.0
*/
class ProviderAlreadyExistsException extends HintException {
-
/**
* ProviderAlreadyExistsException constructor.
*
@@ -44,7 +24,7 @@ class ProviderAlreadyExistsException extends HintException {
* @param string $existingProviderName name of cloud federation provider which already use the same ID
*/
public function __construct($newProviderId, $existingProviderName) {
- $l = \OC::$server->getL10N('federation');
+ $l = \OCP\Util::getL10N('federation');
$message = 'ID "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"';
$hint = $l->t('ID "%1$s" already used by cloud federation provider "%2$s"', [$newProviderId, $existingProviderName]);
parent::__construct($message, $hint);
diff --git a/lib/public/Federation/Exceptions/ProviderCouldNotAddShareException.php b/lib/public/Federation/Exceptions/ProviderCouldNotAddShareException.php
index a7d9b403175..168eb2b8aeb 100644
--- a/lib/public/Federation/Exceptions/ProviderCouldNotAddShareException.php
+++ b/lib/public/Federation/Exceptions/ProviderCouldNotAddShareException.php
@@ -1,30 +1,13 @@
<?php
+
/**
- * @copyright Copyright (c) 2018 Bjoern Schiessle <bjoern@schiessle.org>
- *
- * @author Bjoern Schiessle <bjoern@schiessle.org>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCP\Federation\Exceptions;
-use OC\HintException;
use OCP\AppFramework\Http;
+use OCP\HintException;
/**
* Class ProviderCouldNotAddShareException
@@ -33,7 +16,6 @@ use OCP\AppFramework\Http;
* @since 14.0.0
*/
class ProviderCouldNotAddShareException extends HintException {
-
/**
* ProviderCouldNotAddShareException constructor.
*
@@ -44,7 +26,7 @@ class ProviderCouldNotAddShareException extends HintException {
* @param int $code
* @param \Exception|null $previous
*/
- public function __construct($message, $hint = '', $code = Http::STATUS_BAD_REQUEST, \Exception $previous = null) {
+ public function __construct($message, $hint = '', $code = Http::STATUS_BAD_REQUEST, ?\Exception $previous = null) {
parent::__construct($message, $hint, $code, $previous);
}
}
diff --git a/lib/public/Federation/Exceptions/ProviderDoesNotExistsException.php b/lib/public/Federation/Exceptions/ProviderDoesNotExistsException.php
index 2f3471f981b..64dfcf0f856 100644
--- a/lib/public/Federation/Exceptions/ProviderDoesNotExistsException.php
+++ b/lib/public/Federation/Exceptions/ProviderDoesNotExistsException.php
@@ -1,29 +1,12 @@
<?php
+
/**
- * @copyright Copyright (c) 2018 Bjoern Schiessle <bjoern@schiessle.org>
- *
- * @author Bjoern Schiessle <bjoern@schiessle.org>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCP\Federation\Exceptions;
-use OC\HintException;
+use OCP\HintException;
/**
* Class ProviderDoesNotExistsException
@@ -32,7 +15,6 @@ use OC\HintException;
* @since 14.0.0
*/
class ProviderDoesNotExistsException extends HintException {
-
/**
* ProviderDoesNotExistsException constructor.
*
@@ -41,7 +23,7 @@ class ProviderDoesNotExistsException extends HintException {
* @param string $providerId cloud federation provider ID
*/
public function __construct($providerId) {
- $l = \OC::$server->getL10N('federation');
+ $l = \OCP\Util::getL10N('federation');
$message = 'Cloud Federation Provider with ID: "' . $providerId . '" does not exist.';
$hint = $l->t('Cloud Federation Provider with ID: "%s" does not exist.', [$providerId]);
parent::__construct($message, $hint);
diff --git a/lib/public/Federation/ICloudFederationFactory.php b/lib/public/Federation/ICloudFederationFactory.php
index 13c2d4cf479..5238188b4fa 100644
--- a/lib/public/Federation/ICloudFederationFactory.php
+++ b/lib/public/Federation/ICloudFederationFactory.php
@@ -1,26 +1,9 @@
<?php
+
/**
- * @copyright Copyright (c) 2018 Bjoern Schiessle <bjoern@schiessle.org>
- *
- * @author Bjoern Schiessle <bjoern@schiessle.org>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCP\Federation;
/**
@@ -30,7 +13,6 @@ namespace OCP\Federation;
* @since 14.0.0
*/
interface ICloudFederationFactory {
-
/**
* get a CloudFederationShare Object to prepare a share you want to send
*
diff --git a/lib/public/Federation/ICloudFederationNotification.php b/lib/public/Federation/ICloudFederationNotification.php
index 79712ccc7db..c550a936927 100644
--- a/lib/public/Federation/ICloudFederationNotification.php
+++ b/lib/public/Federation/ICloudFederationNotification.php
@@ -1,26 +1,9 @@
<?php
+
/**
- * @copyright Copyright (c) 2018 Bjoern Schiessle <bjoern@schiessle.org>
- *
- * @author Bjoern Schiessle <bjoern@schiessle.org>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCP\Federation;
/**
@@ -30,14 +13,13 @@ namespace OCP\Federation;
* @since 14.0.0
*/
interface ICloudFederationNotification {
-
/**
* add a message to the notification
*
* @param string $notificationType (e.g. SHARE_ACCEPTED)
* @param string $resourceType (e.g. file, calendar, contact,...)
- * @param $providerId id of the share
- * @param array $notification , payload of the notification
+ * @param string $providerId id of the share
+ * @param array $notification payload of the notification
*
* @since 14.0.0
*/
diff --git a/lib/public/Federation/ICloudFederationProvider.php b/lib/public/Federation/ICloudFederationProvider.php
index f53dff23efd..b30041f81d6 100644
--- a/lib/public/Federation/ICloudFederationProvider.php
+++ b/lib/public/Federation/ICloudFederationProvider.php
@@ -1,27 +1,9 @@
<?php
+
/**
- * @copyright Copyright (c) 2018 Bjoern Schiessle <bjoern@schiessle.org>
- *
- * @author Bjoern Schiessle <bjoern@schiessle.org>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCP\Federation;
use OCP\Federation\Exceptions\ActionNotSupportedException;
@@ -40,7 +22,6 @@ use OCP\Share\Exceptions\ShareNotFound;
*/
interface ICloudFederationProvider {
-
/**
* get the name of the share type, handled by this provider
*
@@ -68,7 +49,7 @@ interface ICloudFederationProvider {
* @param string $notificationType (e.g SHARE_ACCEPTED)
* @param string $providerId share ID
* @param array $notification provider specific notification
- * @return array $data send back to sender
+ * @return array<string> $data send back to sender
*
* @throws ShareNotFound
* @throws ActionNotSupportedException
diff --git a/lib/public/Federation/ICloudFederationProviderManager.php b/lib/public/Federation/ICloudFederationProviderManager.php
index 133683984b8..68adb4b4da7 100644
--- a/lib/public/Federation/ICloudFederationProviderManager.php
+++ b/lib/public/Federation/ICloudFederationProviderManager.php
@@ -1,29 +1,14 @@
<?php
+
/**
- * @copyright Copyright (c) 2018 Bjoern Schiessle <bjoern@schiessle.org>
- *
- * @author Bjoern Schiessle <bjoern@schiessle.org>
- * @author Joas Schilling <coding@schilljs.com>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCP\Federation;
+use OCP\Http\Client\IResponse;
+use OCP\OCM\Exceptions\OCMProviderException;
+
/**
* Class ICloudFederationProviderManager
*
@@ -33,7 +18,6 @@ namespace OCP\Federation;
*
*/
interface ICloudFederationProviderManager {
-
/**
* Registers an callback function which must return an cloud federation provider
*
@@ -82,21 +66,40 @@ interface ICloudFederationProviderManager {
* @return mixed
*
* @since 14.0.0
+ * @deprecated 29.0.0 - Use {@see sendCloudShare()} instead and handle errors manually
*/
public function sendShare(ICloudFederationShare $share);
/**
+ * @param ICloudFederationShare $share
+ * @return IResponse
+ * @throws OCMProviderException
+ * @since 29.0.0
+ */
+ public function sendCloudShare(ICloudFederationShare $share): IResponse;
+
+ /**
* send notification about existing share
*
* @param string $url
* @param ICloudFederationNotification $notification
- * @return mixed
+ * @return array|false
*
* @since 14.0.0
+ * @deprecated 29.0.0 - Use {@see sendCloudNotification()} instead and handle errors manually
*/
public function sendNotification($url, ICloudFederationNotification $notification);
/**
+ * @param string $url
+ * @param ICloudFederationNotification $notification
+ * @return IResponse
+ * @throws OCMProviderException
+ * @since 29.0.0
+ */
+ public function sendCloudNotification(string $url, ICloudFederationNotification $notification): IResponse;
+
+ /**
* check if the new cloud federation API is ready to be used
*
* @return bool
diff --git a/lib/public/Federation/ICloudFederationShare.php b/lib/public/Federation/ICloudFederationShare.php
index dd8c3258668..0b67bbfadee 100644
--- a/lib/public/Federation/ICloudFederationShare.php
+++ b/lib/public/Federation/ICloudFederationShare.php
@@ -1,26 +1,9 @@
<?php
+
/**
- * @copyright Copyright (c) 2018 Bjoern Schiessle <bjoern@schiessle.org>
- *
- * @author Bjoern Schiessle <bjoern@schiessle.org>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCP\Federation;
/**
@@ -30,7 +13,6 @@ namespace OCP\Federation;
* @since 14.0.0
*/
interface ICloudFederationShare {
-
/**
* set uid of the recipient
*
diff --git a/lib/public/Federation/ICloudId.php b/lib/public/Federation/ICloudId.php
index 1399a08188c..44b653e327e 100644
--- a/lib/public/Federation/ICloudId.php
+++ b/lib/public/Federation/ICloudId.php
@@ -3,28 +3,9 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2017, Robin Appelman <robin@icewind.nl>
- *
- * @author Robin Appelman <robin@icewind.nl>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCP\Federation;
/**
diff --git a/lib/public/Federation/ICloudIdManager.php b/lib/public/Federation/ICloudIdManager.php
index b5821721ff8..29e261ab3af 100644
--- a/lib/public/Federation/ICloudIdManager.php
+++ b/lib/public/Federation/ICloudIdManager.php
@@ -3,36 +3,19 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2017, Robin Appelman <robin@icewind.nl>
- *
- * @author Joas Schilling <coding@schilljs.com>
- * @author Robin Appelman <robin@icewind.nl>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCP\Federation;
+use OCP\AppFramework\Attribute\Consumable;
+
/**
* Interface for resolving federated cloud ids
*
* @since 12.0.0
*/
+#[Consumable(since: '12.0.0')]
interface ICloudIdManager {
/**
* @param string $cloudId
@@ -47,12 +30,12 @@ interface ICloudIdManager {
* Get the cloud id for a remote user
*
* @param string $user
- * @param string $remote
+ * @param string|null $remote (optional since 23.0.0 for local users)
* @return ICloudId
*
* @since 12.0.0
*/
- public function getCloudId(string $user, string $remote): ICloudId;
+ public function getCloudId(string $user, ?string $remote): ICloudId;
/**
* Check if the input is a correctly formatted cloud id
@@ -63,4 +46,40 @@ interface ICloudIdManager {
* @since 12.0.0
*/
public function isValidCloudId(string $cloudId): bool;
+
+ /**
+ * remove scheme/protocol from an url
+ *
+ * @param string $url
+ * @param bool $httpsOnly
+ *
+ * @return string
+ * @since 28.0.0
+ * @since 30.0.0 - Optional parameter $httpsOnly was added
+ */
+ public function removeProtocolFromUrl(string $url, bool $httpsOnly = false): string;
+
+ /**
+ * @param string $id The remote cloud id
+ * @param string $user The user id on the remote server
+ * @param string $remote The base address of the remote server
+ * @param ?string $displayName The displayname of the remote user
+ *
+ * @since 32.0.0
+ */
+ public function createCloudId(string $id, string $user, string $remote, ?string $displayName = null): ICloudId;
+
+ /**
+ * @param $resolver The cloud id resolver to register
+ *
+ * @since 32.0.0
+ */
+ public function registerCloudIdResolver(ICloudIdResolver $resolver): void;
+
+ /**
+ * @param $resolver The cloud id resolver to unregister
+ *
+ * @since 32.0.0
+ */
+ public function unregisterCloudIdResolver(ICloudIdResolver $resolver): void;
}
diff --git a/lib/public/Federation/ICloudIdResolver.php b/lib/public/Federation/ICloudIdResolver.php
new file mode 100644
index 00000000000..79f9ed11dd7
--- /dev/null
+++ b/lib/public/Federation/ICloudIdResolver.php
@@ -0,0 +1,40 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+namespace OCP\Federation;
+
+use OCP\AppFramework\Attribute\Consumable;
+use OCP\AppFramework\Attribute\Implementable;
+
+/**
+ * Interface for resolving federated cloud ids
+ *
+ * @since 32.0.0
+ */
+#[Consumable(since: '32.0.0')]
+#[Implementable(since: '32.0.0')]
+interface ICloudIdResolver {
+ /**
+ * @param string $cloudId
+ * @return ICloudId
+ * @throws \InvalidArgumentException
+ *
+ * @since 32.0.0
+ */
+ public function resolveCloudId(string $cloudId): ICloudId;
+
+ /**
+ * Check if the input is a correctly formatted cloud id
+ *
+ * @param string $cloudId
+ * @return bool
+ *
+ * @since 32.0.0
+ */
+ public function isValidCloudId(string $cloudId): bool;
+}