private bool TryHitCache(string remoteHost, string userName)
        {
            if (string.IsNullOrEmpty(remoteHost))
            {
                _logger.Warning($"Remote host parameter miss for user {userName}");
                return(false);
            }

            var id = AuthenticatedClient.CreateId(remoteHost, userName);

            if (_authenticatedClients.TryGetValue(id, out var authenticatedClient))
            {
                _logger.Debug($"User {userName} from {remoteHost} authenticated {authenticatedClient.Elapsed.ToString("hh\\:mm\\:ss")} ago. Bypass period: {_configuration.BypassSecondFactorPeriod}m");

                if (authenticatedClient.Elapsed.TotalMinutes <= (_configuration.BypassSecondFactorPeriod ?? 0))
                {
                    return(true);
                }
                else
                {
                    _authenticatedClients.TryRemove(id, out _);
                }
            }

            return(false);
        }
        private void SetCache(string remoteHost, string userName)
        {
            if (string.IsNullOrEmpty(remoteHost))
            {
                return;
            }

            var client = new AuthenticatedClient
            {
                RemoteHost      = remoteHost,
                UserName        = userName,
                AuthenticatedAt = DateTime.Now
            };

            if (!_authenticatedClients.ContainsKey(client.Id))
            {
                _authenticatedClients.TryAdd(client.Id, client);
            }
        }