diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dav/lib/Connector/PublicAuth.php | 6 | ||||
-rw-r--r-- | apps/dav/lib/Connector/Sabre/Auth.php | 6 | ||||
-rw-r--r-- | apps/dav/lib/Direct/DirectHome.php | 8 | ||||
-rw-r--r-- | apps/dav/lib/Direct/ServerFactory.php | 5 | ||||
-rw-r--r-- | apps/dav/tests/unit/Connector/PublicAuthTest.php | 6 | ||||
-rw-r--r-- | apps/dav/tests/unit/Connector/Sabre/AuthTest.php | 6 | ||||
-rw-r--r-- | apps/dav/tests/unit/Direct/DirectHomeTest.php | 6 | ||||
-rw-r--r-- | apps/oauth2/lib/Controller/OauthApiController.php | 4 | ||||
-rw-r--r-- | apps/oauth2/tests/Controller/OauthApiControllerTest.php | 6 |
9 files changed, 28 insertions, 25 deletions
diff --git a/apps/dav/lib/Connector/PublicAuth.php b/apps/dav/lib/Connector/PublicAuth.php index cc51a249e75..6f58e89f1c0 100644 --- a/apps/dav/lib/Connector/PublicAuth.php +++ b/apps/dav/lib/Connector/PublicAuth.php @@ -29,9 +29,9 @@ */ namespace OCA\DAV\Connector; -use OC\Security\Bruteforce\Throttler; use OCP\IRequest; use OCP\ISession; +use OCP\Security\Bruteforce\IThrottler; use OCP\Share\Exceptions\ShareNotFound; use OCP\Share\IManager; use OCP\Share\IShare; @@ -48,12 +48,12 @@ class PublicAuth extends AbstractBasic { private IManager $shareManager; private ISession $session; private IRequest $request; - private Throttler $throttler; + private IThrottler $throttler; public function __construct(IRequest $request, IManager $shareManager, ISession $session, - Throttler $throttler) { + IThrottler $throttler) { $this->request = $request; $this->shareManager = $shareManager; $this->session = $session; diff --git a/apps/dav/lib/Connector/Sabre/Auth.php b/apps/dav/lib/Connector/Sabre/Auth.php index 75e3f61fded..29e39349704 100644 --- a/apps/dav/lib/Connector/Sabre/Auth.php +++ b/apps/dav/lib/Connector/Sabre/Auth.php @@ -36,12 +36,12 @@ namespace OCA\DAV\Connector\Sabre; use Exception; use OC\Authentication\Exceptions\PasswordLoginForbiddenException; use OC\Authentication\TwoFactorAuth\Manager; -use OC\Security\Bruteforce\Throttler; use OC\User\Session; use OCA\DAV\Connector\Sabre\Exception\PasswordLoginForbidden; use OCA\DAV\Connector\Sabre\Exception\TooManyRequests; use OCP\IRequest; use OCP\ISession; +use OCP\Security\Bruteforce\IThrottler; use OCP\Security\Bruteforce\MaxDelayReached; use Psr\Log\LoggerInterface; use Sabre\DAV\Auth\Backend\AbstractBasic; @@ -58,13 +58,13 @@ class Auth extends AbstractBasic { private IRequest $request; private ?string $currentUser = null; private Manager $twoFactorManager; - private Throttler $throttler; + private IThrottler $throttler; public function __construct(ISession $session, Session $userSession, IRequest $request, Manager $twoFactorManager, - Throttler $throttler, + IThrottler $throttler, string $principalPrefix = 'principals/users/') { $this->session = $session; $this->userSession = $userSession; diff --git a/apps/dav/lib/Direct/DirectHome.php b/apps/dav/lib/Direct/DirectHome.php index 5453a61ed46..8fc8b555db5 100644 --- a/apps/dav/lib/Direct/DirectHome.php +++ b/apps/dav/lib/Direct/DirectHome.php @@ -26,13 +26,13 @@ declare(strict_types=1); */ namespace OCA\DAV\Direct; -use OC\Security\Bruteforce\Throttler; use OCA\DAV\Db\DirectMapper; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Utility\ITimeFactory; use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\IRootFolder; use OCP\IRequest; +use OCP\Security\Bruteforce\IThrottler; use Sabre\DAV\Exception\Forbidden; use Sabre\DAV\Exception\MethodNotAllowed; use Sabre\DAV\Exception\NotFound; @@ -49,18 +49,20 @@ class DirectHome implements ICollection { /** @var ITimeFactory */ private $timeFactory; - /** @var Throttler */ + /** @var IThrottler */ private $throttler; /** @var IRequest */ private $request; + + /** @var IEventDispatcher */ private $eventDispatcher; public function __construct( IRootFolder $rootFolder, DirectMapper $mapper, ITimeFactory $timeFactory, - Throttler $throttler, + IThrottler $throttler, IRequest $request, IEventDispatcher $eventDispatcher ) { diff --git a/apps/dav/lib/Direct/ServerFactory.php b/apps/dav/lib/Direct/ServerFactory.php index 05587ab4c2c..ce689b1e88e 100644 --- a/apps/dav/lib/Direct/ServerFactory.php +++ b/apps/dav/lib/Direct/ServerFactory.php @@ -27,7 +27,6 @@ declare(strict_types=1); */ namespace OCA\DAV\Direct; -use OC\Security\Bruteforce\Throttler; use OCA\DAV\Connector\Sabre\MaintenancePlugin; use OCA\DAV\Db\DirectMapper; use OCP\AppFramework\Utility\ITimeFactory; @@ -37,12 +36,14 @@ use OCP\IConfig; use OCP\IL10N; use OCP\IRequest; use OCP\L10N\IFactory; +use OCP\Security\Bruteforce\IThrottler; class ServerFactory { /** @var IConfig */ private $config; /** @var IL10N */ private $l10n; + /** @var IEventDispatcher */ private $eventDispatcher; public function __construct(IConfig $config, IFactory $l10nFactory, IEventDispatcher $eventDispatcher) { @@ -56,7 +57,7 @@ class ServerFactory { IRootFolder $rootFolder, DirectMapper $mapper, ITimeFactory $timeFactory, - Throttler $throttler, + IThrottler $throttler, IRequest $request): Server { $home = new DirectHome($rootFolder, $mapper, $timeFactory, $throttler, $request, $this->eventDispatcher); $server = new Server($home); diff --git a/apps/dav/tests/unit/Connector/PublicAuthTest.php b/apps/dav/tests/unit/Connector/PublicAuthTest.php index bbb391c8f28..25cad495ce9 100644 --- a/apps/dav/tests/unit/Connector/PublicAuthTest.php +++ b/apps/dav/tests/unit/Connector/PublicAuthTest.php @@ -26,9 +26,9 @@ */ namespace OCA\DAV\Tests\unit\Connector; -use OC\Security\Bruteforce\Throttler; use OCP\IRequest; use OCP\ISession; +use OCP\Security\Bruteforce\IThrottler; use OCP\Share\Exceptions\ShareNotFound; use OCP\Share\IManager; use OCP\Share\IShare; @@ -50,7 +50,7 @@ class PublicAuthTest extends \Test\TestCase { private $shareManager; /** @var \OCA\DAV\Connector\PublicAuth */ private $auth; - /** @var Throttler|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IThrottler|\PHPUnit\Framework\MockObject\MockObject */ private $throttler; /** @var string */ @@ -68,7 +68,7 @@ class PublicAuthTest extends \Test\TestCase { $this->shareManager = $this->getMockBuilder(IManager::class) ->disableOriginalConstructor() ->getMock(); - $this->throttler = $this->getMockBuilder(Throttler::class) + $this->throttler = $this->getMockBuilder(IThrottler::class) ->disableOriginalConstructor() ->getMock(); diff --git a/apps/dav/tests/unit/Connector/Sabre/AuthTest.php b/apps/dav/tests/unit/Connector/Sabre/AuthTest.php index b3b3341240a..06559261f3c 100644 --- a/apps/dav/tests/unit/Connector/Sabre/AuthTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/AuthTest.php @@ -30,11 +30,11 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre; use OC\Authentication\TwoFactorAuth\Manager; -use OC\Security\Bruteforce\Throttler; use OC\User\Session; use OCP\IRequest; use OCP\ISession; use OCP\IUser; +use OCP\Security\Bruteforce\IThrottler; use Sabre\DAV\Server; use Sabre\HTTP\RequestInterface; use Sabre\HTTP\ResponseInterface; @@ -57,7 +57,7 @@ class AuthTest extends TestCase { private $request; /** @var Manager */ private $twoFactorManager; - /** @var Throttler */ + /** @var IThrottler */ private $throttler; protected function setUp(): void { @@ -71,7 +71,7 @@ class AuthTest extends TestCase { $this->twoFactorManager = $this->getMockBuilder(Manager::class) ->disableOriginalConstructor() ->getMock(); - $this->throttler = $this->getMockBuilder(Throttler::class) + $this->throttler = $this->getMockBuilder(IThrottler::class) ->disableOriginalConstructor() ->getMock(); $this->auth = new \OCA\DAV\Connector\Sabre\Auth( diff --git a/apps/dav/tests/unit/Direct/DirectHomeTest.php b/apps/dav/tests/unit/Direct/DirectHomeTest.php index 01214b3c48b..0d0203509ff 100644 --- a/apps/dav/tests/unit/Direct/DirectHomeTest.php +++ b/apps/dav/tests/unit/Direct/DirectHomeTest.php @@ -27,7 +27,6 @@ declare(strict_types=1); */ namespace OCA\DAV\Tests\Unit\Direct; -use OC\Security\Bruteforce\Throttler; use OCA\DAV\Db\Direct; use OCA\DAV\Db\DirectMapper; use OCA\DAV\Direct\DirectFile; @@ -37,6 +36,7 @@ use OCP\AppFramework\Utility\ITimeFactory; use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\IRootFolder; use OCP\IRequest; +use OCP\Security\Bruteforce\IThrottler; use Sabre\DAV\Exception\Forbidden; use Sabre\DAV\Exception\MethodNotAllowed; use Sabre\DAV\Exception\NotFound; @@ -53,7 +53,7 @@ class DirectHomeTest extends TestCase { /** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */ private $timeFactory; - /** @var Throttler|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IThrottler|\PHPUnit\Framework\MockObject\MockObject */ private $throttler; /** @var IRequest */ @@ -71,7 +71,7 @@ class DirectHomeTest extends TestCase { $this->directMapper = $this->createMock(DirectMapper::class); $this->rootFolder = $this->createMock(IRootFolder::class); $this->timeFactory = $this->createMock(ITimeFactory::class); - $this->throttler = $this->createMock(Throttler::class); + $this->throttler = $this->createMock(IThrottler::class); $this->request = $this->createMock(IRequest::class); $this->eventDispatcher = $this->createMock(IEventDispatcher::class); diff --git a/apps/oauth2/lib/Controller/OauthApiController.php b/apps/oauth2/lib/Controller/OauthApiController.php index 8cdd8132441..af1205be0d7 100644 --- a/apps/oauth2/lib/Controller/OauthApiController.php +++ b/apps/oauth2/lib/Controller/OauthApiController.php @@ -31,7 +31,6 @@ namespace OCA\OAuth2\Controller; use OC\Authentication\Exceptions\ExpiredTokenException; use OC\Authentication\Exceptions\InvalidTokenException; use OC\Authentication\Token\IProvider as TokenProvider; -use OC\Security\Bruteforce\Throttler; use OCA\OAuth2\Db\AccessTokenMapper; use OCA\OAuth2\Db\ClientMapper; use OCA\OAuth2\Exceptions\AccessTokenNotFoundException; @@ -41,6 +40,7 @@ use OCP\AppFramework\Http; use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Utility\ITimeFactory; use OCP\IRequest; +use OCP\Security\Bruteforce\IThrottler; use OCP\Security\ICrypto; use OCP\Security\ISecureRandom; use Psr\Log\LoggerInterface; @@ -57,7 +57,7 @@ class OauthApiController extends Controller { private ISecureRandom $secureRandom, private ITimeFactory $time, private LoggerInterface $logger, - private Throttler $throttler + private IThrottler $throttler ) { parent::__construct($appName, $request); } diff --git a/apps/oauth2/tests/Controller/OauthApiControllerTest.php b/apps/oauth2/tests/Controller/OauthApiControllerTest.php index c65302532a9..a7dc35943f0 100644 --- a/apps/oauth2/tests/Controller/OauthApiControllerTest.php +++ b/apps/oauth2/tests/Controller/OauthApiControllerTest.php @@ -29,7 +29,6 @@ use OC\Authentication\Exceptions\ExpiredTokenException; use OC\Authentication\Exceptions\InvalidTokenException; use OC\Authentication\Token\IProvider as TokenProvider; use OC\Authentication\Token\PublicKeyToken; -use OC\Security\Bruteforce\Throttler; use OCA\OAuth2\Controller\OauthApiController; use OCA\OAuth2\Db\AccessToken; use OCA\OAuth2\Db\AccessTokenMapper; @@ -41,6 +40,7 @@ use OCP\AppFramework\Http; use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Utility\ITimeFactory; use OCP\IRequest; +use OCP\Security\Bruteforce\IThrottler; use OCP\Security\ICrypto; use OCP\Security\ISecureRandom; use Psr\Log\LoggerInterface; @@ -66,7 +66,7 @@ class OauthApiControllerTest extends TestCase { private $secureRandom; /** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */ private $time; - /** @var Throttler|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IThrottler|\PHPUnit\Framework\MockObject\MockObject */ private $throttler; /** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */ private $logger; @@ -83,7 +83,7 @@ class OauthApiControllerTest extends TestCase { $this->tokenProvider = $this->createMock(TokenProvider::class); $this->secureRandom = $this->createMock(ISecureRandom::class); $this->time = $this->createMock(ITimeFactory::class); - $this->throttler = $this->createMock(Throttler::class); + $this->throttler = $this->createMock(IThrottler::class); $this->logger = $this->createMock(LoggerInterface::class); $this->oauthApiController = new OauthApiController( |