b14bd302a3
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
41 lines
837 B
PHP
41 lines
837 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace KTXC\Security\Event;
|
|
|
|
use KTXF\Event\Event;
|
|
|
|
final class AuthenticationSucceededEvent extends Event implements SecurityEventInterface
|
|
{
|
|
public function __construct(
|
|
private readonly string $userId,
|
|
?string $tenantId = null,
|
|
) {
|
|
if ($userId === '') {
|
|
throw new \InvalidArgumentException('Successful authentication requires a user ID.');
|
|
}
|
|
|
|
parent::__construct(
|
|
self::class,
|
|
['userId' => $userId],
|
|
$tenantId,
|
|
);
|
|
}
|
|
|
|
public function getUserId(): string
|
|
{
|
|
return $this->userId;
|
|
}
|
|
|
|
public function getReason(): ?string
|
|
{
|
|
return null;
|
|
}
|
|
|
|
public function getSeverity(): SecurityEventSeverity
|
|
{
|
|
return SecurityEventSeverity::INFO;
|
|
}
|
|
}
|