Possible fix for incorrect auth redirect location
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -19,7 +19,8 @@ namespace WebNovelPortal.Controllers
|
||||
{
|
||||
await HttpContext.ChallengeAsync(new AuthenticationProperties
|
||||
{
|
||||
RedirectUri = redirect
|
||||
RedirectUri = redirect,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user