check whitelisted ip when retrieving unauthorized from cache
This commit is contained in:
@@ -102,16 +102,20 @@ internal class SecretKeyAuthenticationHandler
|
|||||||
{
|
{
|
||||||
metrics.IncCounter(MetricsAPI.CounterAuthenticationFailures);
|
metrics.IncCounter(MetricsAPI.CounterAuthenticationFailures);
|
||||||
|
|
||||||
|
logger.LogWarning("Failed authorization from {ip}", ip);
|
||||||
|
|
||||||
lock (failedAuthLock)
|
lock (failedAuthLock)
|
||||||
{
|
{
|
||||||
logger.LogWarning("Failed authorization from {ip}", ip);
|
if (!_whitelistedIps.Any(w => ip.Contains(w)))
|
||||||
if (failedAuthorizations.TryGetValue(ip, out var auth))
|
|
||||||
{
|
{
|
||||||
auth.IncreaseFailedAttempts();
|
if (failedAuthorizations.TryGetValue(ip, out var auth))
|
||||||
}
|
{
|
||||||
else
|
auth.IncreaseFailedAttempts();
|
||||||
{
|
}
|
||||||
failedAuthorizations[ip] = new FailedAuthorization();
|
else
|
||||||
|
{
|
||||||
|
failedAuthorizations[ip] = new FailedAuthorization();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user