Added support for PathBase to be used behind a reverse proxy

This commit is contained in:
Mark Ettema 2019-12-27 04:26:50 +07:00
parent d86435cce5
commit ee132ce9fe
3 changed files with 17 additions and 2 deletions

View file

@ -41,7 +41,11 @@ namespace SteamOpenIdConnectProvider
options.UserInteraction.LoginUrl = "/ExternalLogin";
})
.AddAspNetIdentity<IdentityUser>()
.AddInMemoryClients(IdentityServerConfig.GetClients(Configuration["OpenID:ClientID"], Configuration["OpenID:ClientSecret"], Configuration["OpenID:RedirectUri"], Configuration["OpenID:PostLogoutRedirectUri"]))
.AddInMemoryClients(IdentityServerConfig.GetClients(
Configuration["OpenID:ClientID"],
Configuration["OpenID:ClientSecret"],
Configuration["OpenID:RedirectUri"],
Configuration["OpenID:PostLogoutRedirectUri"]))
.AddInMemoryPersistedGrants()
.AddDeveloperSigningCredential(true)
.AddInMemoryIdentityResources(IdentityServerConfig.GetIdentityResources());
@ -63,6 +67,11 @@ namespace SteamOpenIdConnectProvider
app.UseDeveloperExceptionPage();
}
if (!string.IsNullOrEmpty(Configuration["Hosting:PathBase"]))
{
app.UsePathBase(Configuration["Hosting:PathBase"]);
}
app.UseRouting();
app.UseIdentityServer();
app.UseEndpoints(endpoints =>

View file

@ -5,5 +5,8 @@
"System": "Information",
"Microsoft": "Information"
}
},
"Hosting": {
"PathBase": "/test"
}
}

View file

@ -10,5 +10,8 @@
"RedirectUri": "http://localhost:8080/auth/realms/master/broker/steam/endpoint",
"PostLogoutRedirectUri": ""
},
"AllowedHosts": "*"
"AllowedHosts": "*",
"Hosting": {
"PathBase": ""
}
}