Merge pull request #2 from neothor/add-basepath

Added support for PathBase to be used behind a reverse proxy
This commit is contained in:
neothor 2019-12-27 09:53:34 +01:00 committed by GitHub
commit 6372263571
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 2 deletions

View file

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

View file

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

View file

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