summaryrefslogtreecommitdiffstats
path: root/tests/lib/AppFramework/Http/ResponseTest.php
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2017-04-13 22:50:44 +0200
committerLukas Reschke <lukas@statuscode.ch>2017-04-13 23:05:33 +0200
commit8149945a916447b4e7dae8182dbf0c354e7d19e8 (patch)
tree3217c40a9071b56191bf4dd979900defa4888c5f /tests/lib/AppFramework/Http/ResponseTest.php
parentd0c0f6cfc1871c90cd43d3b005206a360b5bb540 (diff)
downloadnextcloud-server-8149945a916447b4e7dae8182dbf0c354e7d19e8.tar.gz
nextcloud-server-8149945a916447b4e7dae8182dbf0c354e7d19e8.zip
Make BruteForceProtection annotation more clever
This makes the new `@BruteForceProtection` annotation more clever and moves the relevant code into it's own middleware. Basically you can now set `@BruteForceProtection(action=$key)` as annotation and that will make the controller bruteforce protected. However, the difference to before is that you need to call `$responmse->throttle()` to increase the counter. Before the counter was increased every time which leads to all kind of unexpected problems. Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'tests/lib/AppFramework/Http/ResponseTest.php')
-rw-r--r--tests/lib/AppFramework/Http/ResponseTest.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/lib/AppFramework/Http/ResponseTest.php b/tests/lib/AppFramework/Http/ResponseTest.php
index 4840a5f94c3..d8959face89 100644
--- a/tests/lib/AppFramework/Http/ResponseTest.php
+++ b/tests/lib/AppFramework/Http/ResponseTest.php
@@ -264,4 +264,9 @@ class ResponseTest extends \Test\TestCase {
}
+ public function testThrottle() {
+ $this->assertFalse($this->childResponse->isThrottled());
+ $this->childResponse->throttle();
+ $this->assertTrue($this->childResponse->isThrottled());
+ }
}