feat: Introduce typed authentication failure event
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -8,6 +8,7 @@ use KTXC\Context\TenantContextInterface;
|
||||
use KTXC\Models\Firewall\FirewallRuleObject;
|
||||
use KTXC\Models\Firewall\FirewallLogObject;
|
||||
use KTXC\Models\Tenant\TenantConfiguration;
|
||||
use KTXC\Security\Event\AuthenticationFailedEvent;
|
||||
use KTXC\Service\FirewallService;
|
||||
use KTXC\Service\FirewallRuleCache;
|
||||
use KTXC\Service\FirewallRuleManager;
|
||||
@@ -252,7 +253,7 @@ class FirewallServiceTest extends TestCase
|
||||
$this->store->expects($this->never())->method('createLog');
|
||||
|
||||
$this->service->logSecurityEvent(
|
||||
\KTXC\Security\Event\SecurityEvent::authFailure('203.0.113.10')
|
||||
new AuthenticationFailedEvent('203.0.113.10')
|
||||
);
|
||||
}
|
||||
|
||||
@@ -377,7 +378,7 @@ class FirewallServiceTest extends TestCase
|
||||
->willReturn(4);
|
||||
$this->events->expects($this->never())->method('dispatch');
|
||||
|
||||
$event = \KTXC\Security\Event\SecurityEvent::authFailure(
|
||||
$event = new AuthenticationFailedEvent(
|
||||
'203.0.113.10',
|
||||
tenantId: 'tenant-a',
|
||||
);
|
||||
@@ -403,7 +404,7 @@ class FirewallServiceTest extends TestCase
|
||||
->with('tenant-a', '203.0.113.10', 300)
|
||||
->willReturn(0);
|
||||
|
||||
$event = \KTXC\Security\Event\SecurityEvent::authFailure(
|
||||
$event = new AuthenticationFailedEvent(
|
||||
'203.0.113.10',
|
||||
tenantId: 'tenant-a',
|
||||
);
|
||||
@@ -459,7 +460,7 @@ class FirewallServiceTest extends TestCase
|
||||
}
|
||||
});
|
||||
|
||||
$event = \KTXC\Security\Event\SecurityEvent::authFailure(
|
||||
$event = new AuthenticationFailedEvent(
|
||||
'203.0.113.10',
|
||||
tenantId: 'tenant-event',
|
||||
);
|
||||
@@ -485,7 +486,7 @@ class FirewallServiceTest extends TestCase
|
||||
$this->events->expects($this->never())->method('dispatch');
|
||||
|
||||
$this->service->handleAuthFailure(
|
||||
\KTXC\Security\Event\SecurityEvent::authFailure('203.0.113.10')
|
||||
new AuthenticationFailedEvent('203.0.113.10')
|
||||
);
|
||||
}
|
||||
|
||||
@@ -499,7 +500,7 @@ class FirewallServiceTest extends TestCase
|
||||
->willReturn(0);
|
||||
|
||||
$this->service->handleAuthFailure(
|
||||
\KTXC\Security\Event\SecurityEvent::authFailure('203.0.113.10')
|
||||
new AuthenticationFailedEvent('203.0.113.10')
|
||||
);
|
||||
}
|
||||
|
||||
@@ -511,7 +512,7 @@ class FirewallServiceTest extends TestCase
|
||||
$this->store->expects($this->never())->method('depositRule');
|
||||
|
||||
$this->service->handleAuthFailure(
|
||||
\KTXC\Security\Event\SecurityEvent::authFailure('203.0.113.10')
|
||||
new AuthenticationFailedEvent('203.0.113.10')
|
||||
);
|
||||
}
|
||||
|
||||
@@ -525,7 +526,7 @@ class FirewallServiceTest extends TestCase
|
||||
->method('countRecentFailures')
|
||||
->with('tenant-a', '203.0.113.10', 300)
|
||||
->willReturn(1);
|
||||
$event = \KTXC\Security\Event\SecurityEvent::authFailure('203.0.113.10');
|
||||
$event = new AuthenticationFailedEvent('203.0.113.10');
|
||||
$eventId = $event->getEventId();
|
||||
|
||||
$this->service->handleAuthFailure($event);
|
||||
|
||||
Reference in New Issue
Block a user