From b1b01f849a21d14799ee907dd03c34d5662ec545 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 28 Jul 2022 13:54:20 +0200 Subject: [PATCH] Use public throttler Signed-off-by: Joas Schilling --- lib/Controller/PageController.php | 6 +++--- lib/Controller/RoomController.php | 6 +++--- lib/Middleware/InjectionMiddleware.php | 6 +++--- psalm.xml | 1 - 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index aa1c18db7..e869eae95 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -25,7 +25,6 @@ declare(strict_types=1); namespace OCA\Talk\Controller; -use OC\Security\Bruteforce\Throttler; use OCA\Talk\AppInfo\Application; use OCA\Talk\Exceptions\ParticipantNotFoundException; use OCA\Talk\Exceptions\RoomNotFoundException; @@ -57,6 +56,7 @@ use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserSession; use OCP\Notification\IManager as INotificationManager; +use OCP\Security\Bruteforce\IThrottler; use Psr\Log\LoggerInterface; class PageController extends Controller { @@ -74,7 +74,7 @@ class PageController extends Controller { private INotificationManager $notificationManager; private IAppManager $appManager; private IRootFolder $rootFolder; - private Throttler $throttler; + private IThrottler $throttler; public function __construct(string $appName, IRequest $request, @@ -92,7 +92,7 @@ class PageController extends Controller { IInitialState $initialState, ICacheFactory $memcacheFactory, IRootFolder $rootFolder, - Throttler $throttler, + IThrottler $throttler, Config $talkConfig, IConfig $serverConfig) { parent::__construct($appName, $request); diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php index 11ed1ee81..49e2e7a89 100644 --- a/lib/Controller/RoomController.php +++ b/lib/Controller/RoomController.php @@ -28,7 +28,6 @@ declare(strict_types=1); namespace OCA\Talk\Controller; use InvalidArgumentException; -use OC\Security\Bruteforce\Throttler; use OCA\Talk\Chat\ChatManager; use OCA\Talk\Chat\MessageParser; use OCA\Talk\Config; @@ -65,6 +64,7 @@ use OCP\IL10N; use OCP\IRequest; use OCP\IUser; use OCP\IUserManager; +use OCP\Security\Bruteforce\IThrottler; use OCP\User\Events\UserLiveStatusEvent; use OCP\UserStatus\IManager as IUserStatusManager; use OCP\UserStatus\IUserStatus; @@ -92,7 +92,7 @@ class RoomController extends AEnvironmentAwareController { protected IL10N $l10n; protected IConfig $config; protected Config $talkConfig; - protected Throttler $throttler; + protected IThrottler $throttler; protected LoggerInterface $logger; protected array $commonReadMessages = []; @@ -118,7 +118,7 @@ class RoomController extends AEnvironmentAwareController { IConfig $config, Config $talkConfig, ICloudIdManager $cloudIdManager, - Throttler $throttler, + IThrottler $throttler, LoggerInterface $logger) { parent::__construct($appName, $request); $this->session = $session; diff --git a/lib/Middleware/InjectionMiddleware.php b/lib/Middleware/InjectionMiddleware.php index f4e60b4b6..3725af6f8 100644 --- a/lib/Middleware/InjectionMiddleware.php +++ b/lib/Middleware/InjectionMiddleware.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace OCA\Talk\Middleware; -use OC\Security\Bruteforce\Throttler; use OCA\Talk\Controller\AEnvironmentAwareController; use OCA\Talk\Exceptions\ParticipantNotFoundException; use OCA\Talk\Exceptions\PermissionsException; @@ -46,20 +45,21 @@ use OCP\AppFramework\OCS\OCSException; use OCP\AppFramework\OCSController; use OCP\AppFramework\Utility\IControllerMethodReflector; use OCP\IRequest; +use OCP\Security\Bruteforce\IThrottler; class InjectionMiddleware extends Middleware { private IRequest $request; private IControllerMethodReflector $reflector; private TalkSession $talkSession; private Manager $manager; - private Throttler $throttler; + private IThrottler $throttler; private ?string $userId; public function __construct(IRequest $request, IControllerMethodReflector $reflector, TalkSession $talkSession, Manager $manager, - Throttler $throttler, + IThrottler $throttler, ?string $userId) { $this->request = $request; $this->reflector = $reflector; diff --git a/psalm.xml b/psalm.xml index a6c06de54..b82a052fb 100644 --- a/psalm.xml +++ b/psalm.xml @@ -26,7 +26,6 @@ -