refactor(security): add typed brute-force detection event
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -11,6 +11,7 @@ use KTXC\Models\Firewall\FirewallLogObject;
|
||||
use KTXC\Stores\FirewallStore;
|
||||
use KTXC\Context\TenantContextInterface;
|
||||
use KTXC\Security\Event\AuthenticationFailedEvent;
|
||||
use KTXC\Security\Event\BruteForceDetectedEvent;
|
||||
use KTXC\Security\Event\SecurityEvent;
|
||||
use KTXC\Security\Event\SecurityEventInterface;
|
||||
use KTXC\Security\Event\SecurityRequestEventInterface;
|
||||
@@ -200,7 +201,7 @@ class FirewallService
|
||||
int $blockDuration
|
||||
): void {
|
||||
// Publish brute force event
|
||||
$event = SecurityEvent::bruteForceDetected(
|
||||
$event = new BruteForceDetectedEvent(
|
||||
$ipAddress,
|
||||
$failureCount,
|
||||
$windowSeconds,
|
||||
@@ -280,7 +281,7 @@ class FirewallService
|
||||
return match ($eventName) {
|
||||
AuthenticationFailedEvent::class => FirewallLogObject::EVENT_AUTH_FAILURE,
|
||||
SecurityEvent::AUTH_SUCCESS => FirewallLogObject::EVENT_ACCESS_CHECK,
|
||||
SecurityEvent::BRUTE_FORCE_DETECTED => FirewallLogObject::EVENT_BRUTE_FORCE,
|
||||
BruteForceDetectedEvent::class => FirewallLogObject::EVENT_BRUTE_FORCE,
|
||||
SecurityEvent::RATE_LIMIT_EXCEEDED => FirewallLogObject::EVENT_RATE_LIMIT,
|
||||
SecurityEvent::ACCESS_DENIED => FirewallLogObject::EVENT_RULE_MATCH,
|
||||
SecurityEvent::SUSPICIOUS_ACTIVITY => FirewallLogObject::EVENT_SUSPICIOUS,
|
||||
|
||||
Reference in New Issue
Block a user