mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-01 05:54:32 +02:00
Write to event log, when a user gets impersonated
This commit is contained in:
parent
cc1595e048
commit
8a4ede9d43
5 changed files with 80 additions and 0 deletions
|
@ -48,6 +48,7 @@ use App\Events\SecurityEvents;
|
|||
use App\Services\LogSystem\EventLogger;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\Security\Http\Event\SwitchUserEvent;
|
||||
|
||||
/**
|
||||
* This subscriber writes entries to log if a security related event happens (e.g. the user changes its password).
|
||||
|
@ -70,6 +71,7 @@ final class SecurityEventLoggerSubscriber implements EventSubscriberInterface
|
|||
SecurityEvents::GOOGLE_DISABLED => 'google_disabled',
|
||||
SecurityEvents::GOOGLE_ENABLED => 'google_enabled',
|
||||
SecurityEvents::TFA_ADMIN_RESET => 'tfa_admin_reset',
|
||||
SecurityEvents::USER_IMPERSONATED => 'user_impersonated',
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -103,6 +105,11 @@ final class SecurityEventLoggerSubscriber implements EventSubscriberInterface
|
|||
$this->addLog(SecurityEvents::U2F_REMOVED, $event);
|
||||
}
|
||||
|
||||
public function user_impersonated(SecurityEvent $event): void
|
||||
{
|
||||
$this->addLog(SecurityEvents::USER_IMPERSONATED, $event);
|
||||
}
|
||||
|
||||
public function u2f_added(SecurityEvent $event): void
|
||||
{
|
||||
$this->addLog(SecurityEvents::U2F_ADDED, $event);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue