summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJulien Veyssier <julien-nc@posteo.net>2022-11-09 18:46:54 +0100
committerJulien Veyssier <julien-nc@posteo.net>2022-12-07 13:24:50 +0100
commit4a3f3beb0babf312d83b2dc6feb7b036cd106529 (patch)
treef9e45f36c1201d5e35a475d6fdeff10b6fe3da45 /tests
parent3f6415d7133c0010b2f29b48f129f21d09cf6db6 (diff)
downloadnextcloud-server-4a3f3beb0babf312d83b2dc6feb7b036cd106529.tar.gz
nextcloud-server-4a3f3beb0babf312d83b2dc6feb7b036cd106529.zip
use bruteforce protection on all methods wrapped by PublicShareMiddleware
if an invalid token is provided or when share password is wrong Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php b/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php
index 7e7140971e4..7d07bffc46b 100644
--- a/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php
@@ -25,6 +25,7 @@ namespace Test\AppFramework\Middleware\PublicShare;
use OC\AppFramework\Middleware\PublicShare\Exceptions\NeedAuthenticationException;
use OC\AppFramework\Middleware\PublicShare\PublicShareMiddleware;
+use OC\Security\Bruteforce\Throttler;
use OCP\AppFramework\AuthPublicShareController;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\NotFoundResponse;
@@ -44,6 +45,8 @@ class PublicShareMiddlewareTest extends \Test\TestCase {
private $session;
/** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
private $config;
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
+ private $throttler;
/** @var PublicShareMiddleware */
private $middleware;
@@ -55,11 +58,13 @@ class PublicShareMiddlewareTest extends \Test\TestCase {
$this->request = $this->createMock(IRequest::class);
$this->session = $this->createMock(ISession::class);
$this->config = $this->createMock(IConfig::class);
+ $this->throttler = $this->createMock(Throttler::class);
$this->middleware = new PublicShareMiddleware(
$this->request,
$this->session,
- $this->config
+ $this->config,
+ $this->throttler
);
}