3f9c2500d9
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
69 lines
1.3 KiB
PHP
69 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace KTXC\Security\Event;
|
|
|
|
use KTXF\Event\Event;
|
|
|
|
abstract class FirewallIpEvent extends Event implements SecurityRequestEventInterface
|
|
{
|
|
protected const SEVERITY = SecurityEvent::SEVERITY_INFO;
|
|
|
|
final public function __construct(
|
|
private readonly string $ipAddress,
|
|
private readonly ?string $reason = null,
|
|
?string $tenantId = null,
|
|
) {
|
|
if ($ipAddress === '') {
|
|
throw new \InvalidArgumentException('Firewall IP events require an IP address.');
|
|
}
|
|
|
|
parent::__construct(
|
|
static::class,
|
|
['ip' => $ipAddress, 'reason' => $reason],
|
|
$tenantId,
|
|
);
|
|
}
|
|
|
|
public function getIpAddress(): string
|
|
{
|
|
return $this->ipAddress;
|
|
}
|
|
|
|
public function getDeviceFingerprint(): ?string
|
|
{
|
|
return null;
|
|
}
|
|
|
|
public function getUserAgent(): ?string
|
|
{
|
|
return null;
|
|
}
|
|
|
|
public function getRequestPath(): ?string
|
|
{
|
|
return null;
|
|
}
|
|
|
|
public function getRequestMethod(): ?string
|
|
{
|
|
return null;
|
|
}
|
|
|
|
public function getUserId(): ?string
|
|
{
|
|
return null;
|
|
}
|
|
|
|
public function getReason(): ?string
|
|
{
|
|
return $this->reason;
|
|
}
|
|
|
|
public function getSeverity(): int
|
|
{
|
|
return static::SEVERITY;
|
|
}
|
|
}
|