diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-10-23 10:18:20 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-10-23 10:26:25 +0200 |
commit | b82e25ea7a13e98212201a905718309a3d1415ae (patch) | |
tree | 32bfc59d37d8ef9c6f670dd4528e268d127796e7 /lib | |
parent | 16b9373b82ccfe9a0982f4678c16a19298014e27 (diff) | |
download | nextcloud-server-b82e25ea7a13e98212201a905718309a3d1415ae.tar.gz nextcloud-server-b82e25ea7a13e98212201a905718309a3d1415ae.zip |
Move Exceptions used in OCP to OCP
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib')
7 files changed, 126 insertions, 33 deletions
diff --git a/lib/private/Authentication/Exceptions/ExpiredTokenException.php b/lib/private/Authentication/Exceptions/ExpiredTokenException.php index 0dc92b45920..c23a1176fae 100644 --- a/lib/private/Authentication/Exceptions/ExpiredTokenException.php +++ b/lib/private/Authentication/Exceptions/ExpiredTokenException.php @@ -25,19 +25,8 @@ declare(strict_types=1); */ namespace OC\Authentication\Exceptions; -use OC\Authentication\Token\IToken; - -class ExpiredTokenException extends InvalidTokenException { - /** @var IToken */ - private $token; - - public function __construct(IToken $token) { - parent::__construct(); - - $this->token = $token; - } - - public function getToken(): IToken { - return $this->token; - } +/** + * @deprecated 28.0.0 use OCP version instead + */ +class ExpiredTokenException extends \OCP\Authentication\Exceptions\ExpiredTokenException { } diff --git a/lib/private/Authentication/Exceptions/InvalidTokenException.php b/lib/private/Authentication/Exceptions/InvalidTokenException.php index acaabff6b88..7de6e1522fa 100644 --- a/lib/private/Authentication/Exceptions/InvalidTokenException.php +++ b/lib/private/Authentication/Exceptions/InvalidTokenException.php @@ -24,7 +24,8 @@ declare(strict_types=1); */ namespace OC\Authentication\Exceptions; -use Exception; - -class InvalidTokenException extends Exception { +/** + * @deprecated 28.0.0 use OCP version instead + */ +class InvalidTokenException extends \OCP\Authentication\Exceptions\InvalidTokenException { } diff --git a/lib/private/Authentication/Exceptions/WipeTokenException.php b/lib/private/Authentication/Exceptions/WipeTokenException.php index 1c60ab9da78..8ae4f74e4d7 100644 --- a/lib/private/Authentication/Exceptions/WipeTokenException.php +++ b/lib/private/Authentication/Exceptions/WipeTokenException.php @@ -25,19 +25,8 @@ declare(strict_types=1); */ namespace OC\Authentication\Exceptions; -use OC\Authentication\Token\IToken; - -class WipeTokenException extends InvalidTokenException { - /** @var IToken */ - private $token; - - public function __construct(IToken $token) { - parent::__construct(); - - $this->token = $token; - } - - public function getToken(): IToken { - return $this->token; - } +/** + * @deprecated 28.0.0 use OCP version instead + */ +class WipeTokenException extends \OCP\Authentication\Exceptions\WipeTokenException { } diff --git a/lib/public/Authentication/Exceptions/ExpiredTokenException.php b/lib/public/Authentication/Exceptions/ExpiredTokenException.php new file mode 100644 index 00000000000..eab68ba4eff --- /dev/null +++ b/lib/public/Authentication/Exceptions/ExpiredTokenException.php @@ -0,0 +1,40 @@ +<?php + +declare(strict_types=1); + +/** + * @copyright Copyright (c) 2018 Roeland Jago Douma <roeland@famdouma.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/>. + * + */ +namespace OCP\Authentication\Exceptions; + +use OCP\Authentication\Token\IToken; + +class ExpiredTokenException extends InvalidTokenException { + public function __construct( + private IToken $token, + ) { + parent::__construct(); + } + + public function getToken(): IToken { + return $this->token; + } +} diff --git a/lib/public/Authentication/Exceptions/InvalidTokenException.php b/lib/public/Authentication/Exceptions/InvalidTokenException.php new file mode 100644 index 00000000000..2556e191d63 --- /dev/null +++ b/lib/public/Authentication/Exceptions/InvalidTokenException.php @@ -0,0 +1,30 @@ +<?php + +declare(strict_types=1); + +/** + * @copyright Copyright (c) 2016, ownCloud, Inc. + * + * @author Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * 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, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ +namespace OCP\Authentication\Exceptions; + +use Exception; + +class InvalidTokenException extends Exception { +} diff --git a/lib/public/Authentication/Exceptions/WipeTokenException.php b/lib/public/Authentication/Exceptions/WipeTokenException.php new file mode 100644 index 00000000000..aa2da6739e6 --- /dev/null +++ b/lib/public/Authentication/Exceptions/WipeTokenException.php @@ -0,0 +1,40 @@ +<?php + +declare(strict_types=1); + +/** + * @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.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/>. + * + */ +namespace OCP\Authentication\Exceptions; + +use OCP\Authentication\Token\IToken; + +class WipeTokenException extends InvalidTokenException { + public function __construct( + private IToken $token, + ) { + parent::__construct(); + } + + public function getToken(): IToken { + return $this->token; + } +} diff --git a/lib/public/Authentication/Token/IProvider.php b/lib/public/Authentication/Token/IProvider.php index 4c324d685b7..59d2b8f3649 100644 --- a/lib/public/Authentication/Token/IProvider.php +++ b/lib/public/Authentication/Token/IProvider.php @@ -24,6 +24,10 @@ declare(strict_types=1); */ namespace OCP\Authentication\Token; +use OCP\Authentication\Exceptions\ExpiredTokenException; +use OCP\Authentication\Exceptions\InvalidTokenException; +use OCP\Authentication\Exceptions\WipeTokenException; + /** * @since 24.0.8 */ |