84eb0e2c21
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
67 lines
1.3 KiB
PHP
67 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace KTXC\Security\Event;
|
|
|
|
use KTXF\Event\Event;
|
|
|
|
final class DeviceBlockedEvent extends Event implements SecurityRequestEventInterface
|
|
{
|
|
public function __construct(
|
|
private readonly string $deviceFingerprint,
|
|
private readonly ?string $reason = null,
|
|
?string $tenantId = null,
|
|
) {
|
|
if ($deviceFingerprint === '') {
|
|
throw new \InvalidArgumentException('Device-block events require a fingerprint.');
|
|
}
|
|
|
|
parent::__construct(
|
|
self::class,
|
|
['device' => $deviceFingerprint, 'reason' => $reason],
|
|
$tenantId,
|
|
);
|
|
}
|
|
|
|
public function getIpAddress(): ?string
|
|
{
|
|
return null;
|
|
}
|
|
|
|
public function getDeviceFingerprint(): string
|
|
{
|
|
return $this->deviceFingerprint;
|
|
}
|
|
|
|
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(): SecurityEventSeverity
|
|
{
|
|
return SecurityEventSeverity::CRITICAL;
|
|
}
|
|
}
|