diff --git a/src/Bifrost.Web/Features/Heimdall/HeimdallIdentityMoveClient.cs b/src/Bifrost.Web/Features/Heimdall/HeimdallIdentityMoveClient.cs index 69f0255..a92e916 100644 --- a/src/Bifrost.Web/Features/Heimdall/HeimdallIdentityMoveClient.cs +++ b/src/Bifrost.Web/Features/Heimdall/HeimdallIdentityMoveClient.cs @@ -323,13 +323,19 @@ public static class HeimdallClientServices { services.AddHttpClient((serviceProvider, client) => HeimdallAuthService.ConfigureClient(client, serviceProvider.GetRequiredService>().Value)) + .WithoutRedirects() .RedactLoggedHeaders(HeimdallAuthService.RedactsHeader); services.AddHttpClient((serviceProvider, client) => HeimdallMemberClient.ConfigureClient(client, serviceProvider.GetRequiredService>().Value)) + .WithoutRedirects() .RedactLoggedHeaders(HeimdallAuthService.RedactsHeader); services.AddHeimdallIdentityMoveClient(); } + /// A 3xx from Heimdall is its answer: following it would carry the app secret or a member's bearer to another origin. + public static IHttpClientBuilder WithoutRedirects(this IHttpClientBuilder builder) => + builder.ConfigurePrimaryHttpMessageHandler(() => new SocketsHttpHandler { AllowAutoRedirect = false, PooledConnectionLifetime = TimeSpan.FromMinutes(2) }); + /// /// 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>().Value); client.Timeout = HeimdallIdentityMoveClient.Timeout; }) - .ConfigurePrimaryHttpMessageHandler(() => new SocketsHttpHandler { AllowAutoRedirect = false, PooledConnectionLifetime = TimeSpan.FromMinutes(2) }) + .WithoutRedirects() .RedactLoggedHeaders(HeimdallAuthService.RedactsHeader); }