summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2023-10-23 10:57:26 +0200
committerCôme Chilliet <come.chilliet@nextcloud.com>2023-10-23 11:08:23 +0200
commit1bdf952fdeab6305785cae3522eb4807c0e68c99 (patch)
treeaddd703543681866bad2fcb3b89fdb24e32ebd44 /lib
parentb82e25ea7a13e98212201a905718309a3d1415ae (diff)
downloadnextcloud-server-1bdf952fdeab6305785cae3522eb4807c0e68c99.tar.gz
nextcloud-server-1bdf952fdeab6305785cae3522eb4807c0e68c99.zip
Make sure that OC interfaces returns OC interfaces for backward compatibility
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Authentication/Exceptions/ExpiredTokenException.php13
-rw-r--r--lib/private/Authentication/Exceptions/WipeTokenException.php13
-rw-r--r--lib/public/Authentication/Exceptions/ExpiredTokenException.php9
-rw-r--r--lib/public/Authentication/Exceptions/InvalidTokenException.php3
-rw-r--r--lib/public/Authentication/Exceptions/WipeTokenException.php9
5 files changed, 47 insertions, 0 deletions
diff --git a/lib/private/Authentication/Exceptions/ExpiredTokenException.php b/lib/private/Authentication/Exceptions/ExpiredTokenException.php
index c23a1176fae..18618a557f3 100644
--- a/lib/private/Authentication/Exceptions/ExpiredTokenException.php
+++ b/lib/private/Authentication/Exceptions/ExpiredTokenException.php
@@ -25,8 +25,21 @@ declare(strict_types=1);
*/
namespace OC\Authentication\Exceptions;
+use OC\Authentication\Token\IToken;
+
/**
* @deprecated 28.0.0 use OCP version instead
*/
class ExpiredTokenException extends \OCP\Authentication\Exceptions\ExpiredTokenException {
+ public function __construct(
+ IToken $token,
+ ) {
+ parent::__construct($token);
+ }
+
+ public function getToken(): IToken {
+ $token = parent::getToken();
+ /** @var IToken $token We know that we passed OC interface from constructor */
+ return $token;
+ }
}
diff --git a/lib/private/Authentication/Exceptions/WipeTokenException.php b/lib/private/Authentication/Exceptions/WipeTokenException.php
index 8ae4f74e4d7..9b24ca24430 100644
--- a/lib/private/Authentication/Exceptions/WipeTokenException.php
+++ b/lib/private/Authentication/Exceptions/WipeTokenException.php
@@ -25,8 +25,21 @@ declare(strict_types=1);
*/
namespace OC\Authentication\Exceptions;
+use OC\Authentication\Token\IToken;
+
/**
* @deprecated 28.0.0 use OCP version instead
*/
class WipeTokenException extends \OCP\Authentication\Exceptions\WipeTokenException {
+ public function __construct(
+ IToken $token,
+ ) {
+ parent::__construct($token);
+ }
+
+ public function getToken(): IToken {
+ $token = parent::getToken();
+ /** @var IToken $token We know that we passed OC interface from constructor */
+ return $token;
+ }
}
diff --git a/lib/public/Authentication/Exceptions/ExpiredTokenException.php b/lib/public/Authentication/Exceptions/ExpiredTokenException.php
index eab68ba4eff..58f2f22d5c7 100644
--- a/lib/public/Authentication/Exceptions/ExpiredTokenException.php
+++ b/lib/public/Authentication/Exceptions/ExpiredTokenException.php
@@ -27,13 +27,22 @@ namespace OCP\Authentication\Exceptions;
use OCP\Authentication\Token\IToken;
+/**
+ * @since 28.0
+ */
class ExpiredTokenException extends InvalidTokenException {
+ /**
+ * @since 28.0
+ */
public function __construct(
private IToken $token,
) {
parent::__construct();
}
+ /**
+ * @since 28.0
+ */
public function getToken(): IToken {
return $this->token;
}
diff --git a/lib/public/Authentication/Exceptions/InvalidTokenException.php b/lib/public/Authentication/Exceptions/InvalidTokenException.php
index 2556e191d63..7d55694d3ea 100644
--- a/lib/public/Authentication/Exceptions/InvalidTokenException.php
+++ b/lib/public/Authentication/Exceptions/InvalidTokenException.php
@@ -26,5 +26,8 @@ namespace OCP\Authentication\Exceptions;
use Exception;
+/**
+ * @since 28.0
+ */
class InvalidTokenException extends Exception {
}
diff --git a/lib/public/Authentication/Exceptions/WipeTokenException.php b/lib/public/Authentication/Exceptions/WipeTokenException.php
index aa2da6739e6..9e80432ef52 100644
--- a/lib/public/Authentication/Exceptions/WipeTokenException.php
+++ b/lib/public/Authentication/Exceptions/WipeTokenException.php
@@ -27,13 +27,22 @@ namespace OCP\Authentication\Exceptions;
use OCP\Authentication\Token\IToken;
+/**
+ * @since 28.0
+ */
class WipeTokenException extends InvalidTokenException {
+ /**
+ * @since 28.0
+ */
public function __construct(
private IToken $token,
) {
parent::__construct();
}
+ /**
+ * @since 28.0
+ */
public function getToken(): IToken {
return $this->token;
}