]> source.dussan.org Git - nextcloud-server.git/commitdiff
Make sure that OC interfaces returns OC interfaces for backward compatibility
authorCôme Chilliet <come.chilliet@nextcloud.com>
Mon, 23 Oct 2023 08:57:26 +0000 (10:57 +0200)
committerCôme Chilliet <come.chilliet@nextcloud.com>
Mon, 23 Oct 2023 09:08:23 +0000 (11:08 +0200)
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
apps/settings/lib/Controller/AuthSettingsController.php
lib/private/Authentication/Exceptions/ExpiredTokenException.php
lib/private/Authentication/Exceptions/WipeTokenException.php
lib/public/Authentication/Exceptions/ExpiredTokenException.php
lib/public/Authentication/Exceptions/InvalidTokenException.php
lib/public/Authentication/Exceptions/WipeTokenException.php

index 38db7be1e918704cdb5fa9732d2c1f40ad63e752..305908e5e0a74b939875dddfbcf0c5b20d779036 100644 (file)
@@ -53,14 +53,13 @@ use OCP\Session\Exceptions\SessionNotAvailableException;
 use Psr\Log\LoggerInterface;
 
 class AuthSettingsController extends Controller {
-
        /** @var IProvider */
        private $tokenProvider;
 
        /** @var ISession */
        private $session;
 
-       /** IUserSession */
+       /** @var IUserSession */
        private $userSession;
 
        /** @var string */
index c23a1176faef5f9e225a0bb7c3f848c3a0a7c5eb..18618a557f3c26a2eb09fc3f6dbb7dbf58a4daec 100644 (file)
@@ -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;
+       }
 }
index 8ae4f74e4d79540b4ed136024406738fbea82fd9..9b24ca244302125a82a9ce133690f5a2ceb04547 100644 (file)
@@ -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;
+       }
 }
index eab68ba4eff582db49eab60da2a5c7ae07bd3f9c..58f2f22d5c7236b8dd1c99f2b828c4adce276799 100644 (file)
@@ -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;
        }
index 2556e191d630adcfc4126511ac2a0b2c291f15e5..7d55694d3ea8cbd4a2c78f3df49cb21fdf1b192e 100644 (file)
@@ -26,5 +26,8 @@ namespace OCP\Authentication\Exceptions;
 
 use Exception;
 
+/**
+ * @since 28.0
+ */
 class InvalidTokenException extends Exception {
 }
index aa2da6739e63eb963de71a14d0686fbfe4e88264..9e80432ef522daaf6dbff7c97315ec181b64ae14 100644 (file)
@@ -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;
        }