Browse Source

Added forwarded headers

pull/1259/head
Tim McCarthy 5 years ago
parent
commit
e9393b995c
1 changed files with 12 additions and 0 deletions
  1. +12
    -0
      src/Web/WebMVC/Startup.cs

+ 12
- 0
src/Web/WebMVC/Startup.cs View File

@ -7,6 +7,7 @@ using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Diagnostics.HealthChecks; using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.eShopOnContainers.WebMVC.Services; using Microsoft.eShopOnContainers.WebMVC.Services;
using Microsoft.eShopOnContainers.WebMVC.ViewModels; using Microsoft.eShopOnContainers.WebMVC.ViewModels;
@ -57,6 +58,12 @@ namespace Microsoft.eShopOnContainers.WebMVC
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{ {
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Remove("sub"); JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Remove("sub");
app.UseForwardedHeaders(new ForwardedHeadersOptions
{
ForwardedHeaders = ForwardedHeaders.XForwardedProto
});
if (env.IsDevelopment()) if (env.IsDevelopment())
{ {
app.UseDeveloperExceptionPage(); app.UseDeveloperExceptionPage();
@ -193,6 +200,11 @@ namespace Microsoft.eShopOnContainers.WebMVC
var callBackUrl = configuration.GetValue<string>("CallBackUrl"); var callBackUrl = configuration.GetValue<string>("CallBackUrl");
var sessionCookieLifetime = configuration.GetValue("SessionCookieLifetimeMinutes", 60); var sessionCookieLifetime = configuration.GetValue("SessionCookieLifetimeMinutes", 60);
var logger = loggerFactory.CreateLogger<Startup>();
logger.LogInformation($"UseLoadTest: {useLoadTest}");
logger.LogInformation($"IdentityUrl: {identityUrl}");
logger.LogInformation($"CallBackUrl: {callBackUrl}");
// Add Authentication services // Add Authentication services
services.AddAuthentication(options => services.AddAuthentication(options =>


Loading…
Cancel
Save