Skip to content

Commit 1bdf952

Browse files
committed
Make sure that OC interfaces returns OC interfaces for backward compatibility
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
1 parent b82e25e commit 1bdf952

6 files changed

Lines changed: 48 additions & 2 deletions

File tree

apps/settings/lib/Controller/AuthSettingsController.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,13 @@
5353
use Psr\Log\LoggerInterface;
5454

5555
class AuthSettingsController extends Controller {
56-
5756
/** @var IProvider */
5857
private $tokenProvider;
5958

6059
/** @var ISession */
6160
private $session;
6261

63-
/** IUserSession */
62+
/** @var IUserSession */
6463
private $userSession;
6564

6665
/** @var string */

lib/private/Authentication/Exceptions/ExpiredTokenException.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,21 @@
2525
*/
2626
namespace OC\Authentication\Exceptions;
2727

28+
use OC\Authentication\Token\IToken;
29+
2830
/**
2931
* @deprecated 28.0.0 use OCP version instead
3032
*/
3133
class ExpiredTokenException extends \OCP\Authentication\Exceptions\ExpiredTokenException {
34+
public function __construct(
35+
IToken $token,
36+
) {
37+
parent::__construct($token);
38+
}
39+
40+
public function getToken(): IToken {
41+
$token = parent::getToken();
42+
/** @var IToken $token We know that we passed OC interface from constructor */
43+
return $token;
44+
}
3245
}

lib/private/Authentication/Exceptions/WipeTokenException.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,21 @@
2525
*/
2626
namespace OC\Authentication\Exceptions;
2727

28+
use OC\Authentication\Token\IToken;
29+
2830
/**
2931
* @deprecated 28.0.0 use OCP version instead
3032
*/
3133
class WipeTokenException extends \OCP\Authentication\Exceptions\WipeTokenException {
34+
public function __construct(
35+
IToken $token,
36+
) {
37+
parent::__construct($token);
38+
}
39+
40+
public function getToken(): IToken {
41+
$token = parent::getToken();
42+
/** @var IToken $token We know that we passed OC interface from constructor */
43+
return $token;
44+
}
3245
}

lib/public/Authentication/Exceptions/ExpiredTokenException.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,22 @@
2727

2828
use OCP\Authentication\Token\IToken;
2929

30+
/**
31+
* @since 28.0
32+
*/
3033
class ExpiredTokenException extends InvalidTokenException {
34+
/**
35+
* @since 28.0
36+
*/
3137
public function __construct(
3238
private IToken $token,
3339
) {
3440
parent::__construct();
3541
}
3642

43+
/**
44+
* @since 28.0
45+
*/
3746
public function getToken(): IToken {
3847
return $this->token;
3948
}

lib/public/Authentication/Exceptions/InvalidTokenException.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,8 @@
2626

2727
use Exception;
2828

29+
/**
30+
* @since 28.0
31+
*/
2932
class InvalidTokenException extends Exception {
3033
}

lib/public/Authentication/Exceptions/WipeTokenException.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,22 @@
2727

2828
use OCP\Authentication\Token\IToken;
2929

30+
/**
31+
* @since 28.0
32+
*/
3033
class WipeTokenException extends InvalidTokenException {
34+
/**
35+
* @since 28.0
36+
*/
3137
public function __construct(
3238
private IToken $token,
3339
) {
3440
parent::__construct();
3541
}
3642

43+
/**
44+
* @since 28.0
45+
*/
3746
public function getToken(): IToken {
3847
return $this->token;
3948
}

0 commit comments

Comments
 (0)