backend + web: Forward client IP through trusted web proxy
This commit is contained in:
1 parent
32bc5a4691
commit
d8de714481
8 files changed
+138
-19
No files matched your search
@@ -68,6 +68,9 @@ public sealed class BackendFixture : IAsyncLifetime
|
||||
return client;
|
||||
}
|
||||
|
||||
internal WebApplicationFactory<Program> CreateApiBehindProxies(string proxyIp, string webIp) =>
|
||||
new ApiFactory(database.GetConnectionString(), email, TokenSaves, proxyIp, webIp);
|
||||
|
||||
internal async Task<UserDto> RegisterAsync(HttpClient client)
|
||||
{
|
||||
var address = $"{Guid.NewGuid():N}@student.example.test";
|
||||
@@ -137,7 +140,8 @@ public sealed class BackendFixture : IAsyncLifetime
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class ApiFactory(string connectionString, TestEmailSender email, TokenSaveGate tokenSaves)
|
||||
private sealed class ApiFactory(string connectionString, TestEmailSender email, TokenSaveGate tokenSaves,
|
||||
string proxyIp = "", string webIp = "")
|
||||
: WebApplicationFactory<Program>
|
||||
{
|
||||
private readonly Dictionary<string, string?> settings = new()
|
||||
@@ -152,7 +156,8 @@ public sealed class BackendFixture : IAsyncLifetime
|
||||
["Firebase:ServiceAccountJson"] = "",
|
||||
["Smtp:Mailbox"] = "",
|
||||
["Smtp:Password"] = "",
|
||||
["ReverseProxy:TrustedIp"] = "",
|
||||
["ReverseProxy:TrustedIp"] = proxyIp,
|
||||
["ReverseProxy:TrustedWebIp"] = webIp,
|
||||
};
|
||||
|
||||
protected override IHost CreateHost(IHostBuilder builder)
|
||||
|
||||
Reference in new issue
Block a user