Added Identity server code to handle if the IdentityServer is being hosted on https or not
This commit is contained in:
parent
d511db00a4
commit
f97a187723
@ -75,11 +75,22 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
|
|||||||
var connectionString = Configuration["ConnectionString"];
|
var connectionString = Configuration["ConnectionString"];
|
||||||
var migrationsAssembly = typeof(Startup).GetTypeInfo().Assembly.GetName().Name;
|
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
|
// Adds IdentityServer
|
||||||
services.AddIdentityServer(x =>
|
services.AddIdentityServer(x =>
|
||||||
{
|
{
|
||||||
x.IssuerUri = "null";
|
x.IssuerUri = "null";
|
||||||
x.Authentication.CookieLifetime = TimeSpan.FromHours(2);
|
x.Authentication.CookieLifetime = TimeSpan.FromHours(2);
|
||||||
|
|
||||||
|
// Need this if using https
|
||||||
|
if (isUsingHttps)
|
||||||
|
{
|
||||||
|
x.PublicOrigin = identityUrl;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.AddDevspacesIfNeeded(Configuration.GetValue("EnableDevspaces", false))
|
.AddDevspacesIfNeeded(Configuration.GetValue("EnableDevspaces", false))
|
||||||
.AddSigningCredential(Certificate.Get())
|
.AddSigningCredential(Certificate.Get())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user