check for existence of WhitelistedIps

This commit is contained in:
Stanley Dimant
2022-10-20 23:54:25 +02:00
parent 8164d737bf
commit c13e457780

View File

@@ -179,10 +179,14 @@ public class SecretKeyAuthenticationHandler
logger.LogInformation("FailedAuthForTempBan: {num}", _failedAttemptsForTempBan); logger.LogInformation("FailedAuthForTempBan: {num}", _failedAttemptsForTempBan);
_tempBanMinutes = config.GetValue<int>("TempBanDurationInMinutes", 30); _tempBanMinutes = config.GetValue<int>("TempBanDurationInMinutes", 30);
logger.LogInformation("TempBanMinutes: {num}", _tempBanMinutes); logger.LogInformation("TempBanMinutes: {num}", _tempBanMinutes);
_whitelistedIps = config.GetSection("WhitelistedIps").Get<List<string>>(); var whitelisted = config.GetSection("WhitelistedIps");
foreach (var ip in _whitelistedIps) if (!string.IsNullOrEmpty(whitelisted.Value))
{ {
logger.LogInformation("Whitelisted IP: " + ip); _whitelistedIps = whitelisted.Get<List<string>>();
foreach (var ip in _whitelistedIps)
{
logger.LogInformation("Whitelisted IP: " + ip);
}
} }
} }
} }