diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-01-08 17:47:22 +0100 |
---|---|---|
committer | Côme Chilliet <91878298+come-nc@users.noreply.github.com> | 2024-01-11 14:02:15 +0100 |
commit | 95ea6188dc43aaccd648a9bcdd1a3de77e4233c9 (patch) | |
tree | 5b392901dba729229e934132e398fa8edd1800d8 | |
parent | eee9f1eec417c9bb976046e4114d3df943da62e1 (diff) | |
download | nextcloud-server-95ea6188dc43aaccd648a9bcdd1a3de77e4233c9.tar.gz nextcloud-server-95ea6188dc43aaccd648a9bcdd1a3de77e4233c9.zip |
Suppress or fix psalm errors related to InvalidTokenException
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
5 files changed, 9 insertions, 9 deletions
diff --git a/apps/settings/lib/Controller/AuthSettingsController.php b/apps/settings/lib/Controller/AuthSettingsController.php index cfff6582074..9b21c4bc363 100644 --- a/apps/settings/lib/Controller/AuthSettingsController.php +++ b/apps/settings/lib/Controller/AuthSettingsController.php @@ -293,7 +293,7 @@ class AuthSettingsController extends Controller { $token = $e->getToken(); } if ($token->getUID() !== $this->uid) { - /* We have to throw the OC version so both OC and OCP catches catch it */ + /** @psalm-suppress DeprecatedClass We have to throw the OC version so both OC and OCP catches catch it */ throw new OcInvalidTokenException('This token does not belong to you!'); } return $token; diff --git a/core/Controller/ClientFlowLoginController.php b/core/Controller/ClientFlowLoginController.php index 57f57bbf887..40b47a6685d 100644 --- a/core/Controller/ClientFlowLoginController.php +++ b/core/Controller/ClientFlowLoginController.php @@ -33,7 +33,6 @@ namespace OC\Core\Controller; use OC\Authentication\Events\AppPasswordCreatedEvent; -use OC\Authentication\Exceptions\InvalidTokenException as OcInvalidTokenException; use OC\Authentication\Exceptions\PasswordlessTokenException; use OC\Authentication\Token\IProvider; use OC\Authentication\Token\IToken; @@ -332,7 +331,7 @@ class ClientFlowLoginController extends Controller { try { $token = $this->tokenProvider->getToken($password); if ($token->getLoginName() !== $user) { - throw new OcInvalidTokenException('login name does not match'); + throw new InvalidTokenException('login name does not match'); } } catch (InvalidTokenException $e) { $response = new StandaloneTemplateResponse( diff --git a/core/Controller/ClientFlowLoginV2Controller.php b/core/Controller/ClientFlowLoginV2Controller.php index df522096272..b52672a5ccc 100644 --- a/core/Controller/ClientFlowLoginV2Controller.php +++ b/core/Controller/ClientFlowLoginV2Controller.php @@ -27,7 +27,6 @@ declare(strict_types=1); */ namespace OC\Core\Controller; -use OC\Authentication\Exceptions\InvalidTokenException as OcInvalidTokenException; use OC\Core\Db\LoginFlowV2; use OC\Core\Exception\LoginFlowV2NotFoundException; use OC\Core\Service\LoginFlowV2Service; @@ -212,7 +211,7 @@ class ClientFlowLoginV2Controller extends Controller { try { $token = \OC::$server->get(\OC\Authentication\Token\IProvider::class)->getToken($password); if ($token->getLoginName() !== $user) { - throw new OcInvalidTokenException('login name does not match'); + throw new InvalidTokenException('login name does not match'); } } catch (InvalidTokenException $e) { $response = new StandaloneTemplateResponse( diff --git a/lib/private/Authentication/Token/IProvider.php b/lib/private/Authentication/Token/IProvider.php index 4af5e2b25c3..b852f4e7e86 100644 --- a/lib/private/Authentication/Token/IProvider.php +++ b/lib/private/Authentication/Token/IProvider.php @@ -29,10 +29,10 @@ declare(strict_types=1); */ namespace OC\Authentication\Token; -use OC\Authentication\Exceptions\ExpiredTokenException; -use OC\Authentication\Exceptions\InvalidTokenException; use OC\Authentication\Exceptions\PasswordlessTokenException; -use OC\Authentication\Exceptions\WipeTokenException; +use OCP\Authentication\Exceptions\ExpiredTokenException; +use OCP\Authentication\Exceptions\InvalidTokenException; +use OCP\Authentication\Exceptions\WipeTokenException; interface IProvider { /** diff --git a/lib/private/Authentication/Token/Manager.php b/lib/private/Authentication/Token/Manager.php index 9154092f25a..d84a81705ff 100644 --- a/lib/private/Authentication/Token/Manager.php +++ b/lib/private/Authentication/Token/Manager.php @@ -29,9 +29,9 @@ namespace OC\Authentication\Token; use Doctrine\DBAL\Exception\UniqueConstraintViolationException; use OC\Authentication\Exceptions\InvalidTokenException as OcInvalidTokenException; +use OC\Authentication\Exceptions\PasswordlessTokenException; use OCP\Authentication\Exceptions\ExpiredTokenException; use OCP\Authentication\Exceptions\InvalidTokenException; -use OCP\Authentication\Exceptions\PasswordlessTokenException; use OCP\Authentication\Exceptions\WipeTokenException; use OCP\Authentication\Token\IProvider as OCPIProvider; @@ -222,6 +222,7 @@ class Manager implements IProvider, OCPIProvider { return $this->publicKeyTokenProvider->rotate($token, $oldTokenId, $newTokenId); } + /** @psalm-suppress DeprecatedClass We have to throw the OC version so both OC and OCP catches catch it */ throw new OcInvalidTokenException(); } @@ -234,6 +235,7 @@ class Manager implements IProvider, OCPIProvider { if ($token instanceof PublicKeyToken) { return $this->publicKeyTokenProvider; } + /** @psalm-suppress DeprecatedClass We have to throw the OC version so both OC and OCP catches catch it */ throw new OcInvalidTokenException(); } |