fix(security): emit authentication success events

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-08-06 00:08:58 -04:00
parent 5b3e8f6588
commit b14bd302a3
8 changed files with 183 additions and 52 deletions
@@ -6,17 +6,12 @@ namespace KTXC\Security\Event;
use KTXF\Event\Event;
final class AuthenticationSucceededEvent extends Event implements SecurityRequestEventInterface
final class AuthenticationSucceededEvent extends Event implements SecurityEventInterface
{
public function __construct(
private readonly string $ipAddress,
private readonly string $userId,
?string $tenantId = null,
private readonly ?string $deviceFingerprint = null,
) {
if ($ipAddress === '') {
throw new \InvalidArgumentException('Successful authentication requires an IP address.');
}
if ($userId === '') {
throw new \InvalidArgumentException('Successful authentication requires a user ID.');
}
@@ -28,31 +23,6 @@ final class AuthenticationSucceededEvent extends Event implements SecurityReques
);
}
public function getIpAddress(): string
{
return $this->ipAddress;
}
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 $this->userId;