Added Identity server code to handle if the IdentityServer is being hosted on https or not

This commit is contained in:
Tim McCarthy 2020-03-02 14:50:13 -06:00
parent d511db00a4
commit f97a187723

View File

@ -75,11 +75,22 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
var connectionString = Configuration["ConnectionString"];
var migrationsAssembly = typeof(Startup).GetTypeInfo().Assembly.GetName().Name;
// Check to see if the Identity server is using https
var identityUrl = this.Configuration.GetValue<string>("IdentityUrl");
var identityUri = new Uri(identityUrl);
var isUsingHttps = identityUri.Scheme == Uri.UriSchemeHttps;
// Adds IdentityServer
services.AddIdentityServer(x =>
{
x.IssuerUri = "null";
x.Authentication.CookieLifetime = TimeSpan.FromHours(2);
// Need this if using https
if (isUsingHttps)
{
x.PublicOrigin = identityUrl;
}
})
.AddDevspacesIfNeeded(Configuration.GetValue("EnableDevspaces", false))
.AddSigningCredential(Certificate.Get())