From 8149945a916447b4e7dae8182dbf0c354e7d19e8 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Thu, 13 Apr 2017 22:50:44 +0200 Subject: 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 --- tests/lib/AppFramework/Http/ResponseTest.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests/lib/AppFramework/Http/ResponseTest.php') 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()); + } } -- cgit v1.2.3