Auth and member clients follow no redirect: one WithoutRedirects for all three
The mover's inline no-redirect handler becomes the shared extension; the app-secret auth client and the member-bearer client use it too. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
0599aedf08
commit
8175f6f61e
1 changed files with 7 additions and 1 deletions
|
|
@ -323,13 +323,19 @@ public static class HeimdallClientServices
|
|||
{
|
||||
services.AddHttpClient<HeimdallAuthService>((serviceProvider, client) =>
|
||||
HeimdallAuthService.ConfigureClient(client, serviceProvider.GetRequiredService<IOptions<HeimdallOptions>>().Value))
|
||||
.WithoutRedirects()
|
||||
.RedactLoggedHeaders(HeimdallAuthService.RedactsHeader);
|
||||
services.AddHttpClient<HeimdallMemberClient>((serviceProvider, client) =>
|
||||
HeimdallMemberClient.ConfigureClient(client, serviceProvider.GetRequiredService<IOptions<HeimdallOptions>>().Value))
|
||||
.WithoutRedirects()
|
||||
.RedactLoggedHeaders(HeimdallAuthService.RedactsHeader);
|
||||
services.AddHeimdallIdentityMoveClient();
|
||||
}
|
||||
|
||||
/// <summary>A 3xx from Heimdall is its answer: following it would carry the app secret or a member's bearer to another origin.</summary>
|
||||
public static IHttpClientBuilder WithoutRedirects(this IHttpClientBuilder builder) =>
|
||||
builder.ConfigurePrimaryHttpMessageHandler(() => new SocketsHttpHandler { AllowAutoRedirect = false, PooledConnectionLifetime = TimeSpan.FromMinutes(2) });
|
||||
|
||||
/// <summary>
|
||||
/// The mover's HttpClient: Heimdall's base address and app secret from HeimdallAuthService.ConfigureClient (the one secret path), the
|
||||
/// call deadline, no redirects (a 3xx must never carry the secret or the proofs to another origin), and the shared header redaction.
|
||||
|
|
@ -340,6 +346,6 @@ public static class HeimdallClientServices
|
|||
HeimdallAuthService.ConfigureClient(client, serviceProvider.GetRequiredService<IOptions<HeimdallOptions>>().Value);
|
||||
client.Timeout = HeimdallIdentityMoveClient.Timeout;
|
||||
})
|
||||
.ConfigurePrimaryHttpMessageHandler(() => new SocketsHttpHandler { AllowAutoRedirect = false, PooledConnectionLifetime = TimeSpan.FromMinutes(2) })
|
||||
.WithoutRedirects()
|
||||
.RedactLoggedHeaders(HeimdallAuthService.RedactsHeader);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue