public function onSecurityInteractiveLogin(InteractiveLoginEvent $event)
{
$request = $event->getRequest();
// Skip two-factor authentication for whitelisted IPs
if (in_array($request->getClientIp(), $this->ipWhitelist)) {
return;
}
// Check if security token is supported
$token = $event->getAuthenticationToken();
if (!$this->isTokenSupported($token)) {
return;
}
// Forward to two-factor providers
// They decide if they will do two-factor authentication
$context = $this->authenticationContextFactory->create($request, $token);
$this->authHandler->beginAuthentication($context);
}