Skip to content

Commit

Permalink
Try to fix redirect_uri being http when behind reverse proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
redmushie committed Jul 17, 2024
1 parent e5030a4 commit a610648
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions SS14.Admin/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ public void ConfigureServices(IServiceCollection services)
options.Scope.Add("profile");
options.GetClaimsFromUserInfoEndpoint = true;

options.Events.OnRedirectToIdentityProvider = context =>
{
if (context.ProtocolMessage.RedirectUri.StartsWith("http://"))
{
context.ProtocolMessage.RedirectUri = string.Concat("https://",
context.ProtocolMessage.RedirectUri.AsSpan("http://".Length));
}
return Task.CompletedTask;
};

options.Events.OnTokenValidated = async ctx =>
{
var handler = ctx.HttpContext.RequestServices.GetRequiredService<LoginHandler>();
Expand Down

0 comments on commit a610648

Please sign in to comment.