diff --git a/src/customer-key-store/Startup.cs b/src/customer-key-store/Startup.cs index a6eceb8..2ce368c 100644 --- a/src/customer-key-store/Startup.cs +++ b/src/customer-key-store/Startup.cs @@ -86,6 +86,22 @@ public void ConfigureServices(IServiceCollection services) options.Audience = Configuration["JwtAudience"]; options.TokenValidationParameters.ValidateIssuerSigningKey = true; options.Challenge = "Bearer resource=\"" + Configuration["JwtAudience"] + "\", authorization=\"" + Configuration["JwtAuthorization"] + "\", realm=\"" + Configuration["JwtAudience"] + "\""; + + var proxyConfig = Configuration.GetSection("Proxy"); + if(proxyConfig != null && proxyConfig.Exists()) + { + options.BackchannelHttpHandler = new System.Net.Http.HttpClientHandler + { + UseProxy = true, + Proxy = new System.Net.WebProxy + { + Address = new System.Uri(proxyConfig["address"]), + BypassProxyOnLocal = true, + UseDefaultCredentials = true, + }, + }; + } + options.Events = new JwtBearerEvents { OnChallenge = context =>