Possible fix for incorrect auth redirect location
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-07-17 20:55:28 -04:00
parent 3fbaec1fb6
commit edfc18d7f4
2 changed files with 14 additions and 1 deletions

View File

@@ -19,7 +19,8 @@ namespace WebNovelPortal.Controllers
{
await HttpContext.ChallengeAsync(new AuthenticationProperties
{
RedirectUri = redirect
RedirectUri = redirect,
});
}

View File

@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.HttpOverrides;
using Newtonsoft.Json;
using Treestar.Shared.AccessLayers;
using Treestar.Shared.Authentication.OIDC;
@@ -19,6 +20,11 @@ builder.Services.AddControllers().AddNewtonsoftJson(opt =>
opt.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
});
builder.Services.AddOIDCAuth(builder.Configuration);
builder.Services.Configure<ForwardedHeadersOptions>(options =>
{
options.ForwardedHeaders =
ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
});
var app = builder.Build();
@@ -26,9 +32,15 @@ var app = builder.Build();
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
app.UseForwardedHeaders();
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
else
{
app.UseDeveloperExceptionPage();
app.UseForwardedHeaders();
}
app.UseHttpsRedirection();