diff options
author | pjft <pjft@users.noreply.github.com> | 2021-05-30 21:25:34 +0100 |
---|---|---|
committer | pjft <paulo.j.tavares@gmail.com> | 2021-06-21 20:43:12 +0100 |
commit | b1086e25bb9c92c939116201fe7893ab9a88123a (patch) | |
tree | 8414c76e84a51114bc43710b2a388a0a0831cd9c /tests/Core/Controller | |
parent | 719430559f1a1f28800a9a26d4a5492aae046730 (diff) | |
download | nextcloud-server-b1086e25bb9c92c939116201fe7893ab9a88123a.tar.gz nextcloud-server-b1086e25bb9c92c939116201fe7893ab9a88123a.zip |
Add logging to 2FA failure
For security reasons, we may want to monitor failures of 2FA challenges in order to ban attackers who might try to access compromised accounts but are stopped by the 2FA challenge.
Right now, the only hindrance is rate-limiting, but it's probably not enough.
Added dependency injection.
Signed-off-by: pjft <paulo.j.tavares@gmail.com>
Diffstat (limited to 'tests/Core/Controller')
-rw-r--r-- | tests/Core/Controller/TwoFactorChallengeControllerTest.php | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/Core/Controller/TwoFactorChallengeControllerTest.php b/tests/Core/Controller/TwoFactorChallengeControllerTest.php index 1a2a4d8eaa5..b899a1b236a 100644 --- a/tests/Core/Controller/TwoFactorChallengeControllerTest.php +++ b/tests/Core/Controller/TwoFactorChallengeControllerTest.php @@ -57,6 +57,9 @@ class TwoFactorChallengeControllerTest extends TestCase { /** @var IURLGenerator|\PHPUnit\Framework\MockObject\MockObject */ private $urlGenerator; + /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */ + private $logger; + /** @var TwoFactorChallengeController|\PHPUnit\Framework\MockObject\MockObject */ private $controller; @@ -68,6 +71,7 @@ class TwoFactorChallengeControllerTest extends TestCase { $this->userSession = $this->createMock(IUserSession::class); $this->session = $this->createMock(ISession::class); $this->urlGenerator = $this->createMock(IURLGenerator::class); + $this->logger = $this->createMock(ILogger::class); $this->controller = $this->getMockBuilder(TwoFactorChallengeController::class) ->setConstructorArgs([ @@ -77,6 +81,7 @@ class TwoFactorChallengeControllerTest extends TestCase { $this->userSession, $this->session, $this->urlGenerator, + $this->logger, ]) ->setMethods(['getLogoutUrl']) ->getMock(); |