fix(api): получения ip адреса за балансировщиком
This commit is contained in:
@@ -25,7 +25,7 @@ namespace PARR.API.Authentication
|
||||
var ipClient = Request.HttpContext.Connection.RemoteIpAddress?.MapToIPv4().ToString();
|
||||
|
||||
if (ipClient == null)
|
||||
return AuthenticateResult.Fail($"IP address not defined.");
|
||||
return AuthenticateResult.Fail($"IP address not defined. IP: {ipClient}");
|
||||
|
||||
// Аутентификация - просто проверка, есть ли у нас такой пользователь
|
||||
using (var scope = serviceProvider.CreateScope())
|
||||
@@ -34,11 +34,11 @@ namespace PARR.API.Authentication
|
||||
|
||||
var userIsBlocked = await authService.UserIsBlockedAsync(ipClient);
|
||||
if (userIsBlocked)
|
||||
return AuthenticateResult.Fail($"IP address is on the blocking list.");
|
||||
return AuthenticateResult.Fail($"IP address is on the blocking list. IP: {ipClient}");
|
||||
|
||||
var user = await authService.GetUserAsync(ipClient);
|
||||
if (user == null)
|
||||
return AuthenticateResult.Fail($"IP address not defined.");
|
||||
return AuthenticateResult.Fail($"IP address not defined. IP: {ipClient}");
|
||||
|
||||
|
||||
// пользователь найден, аутентификация пройдена
|
||||
|
||||
Reference in New Issue
Block a user