public void Configuration(IAppBuilder app) { #if DEBUG const string serverName = "devservername"; #else const string serverName = "prodservername"; #endif LogProvider.SetCurrentLogProvider(new TraceSourceLogProvider()); const string connectionName = "AspId"; var factory = new IdentityServerServiceFactory(); factory.ConfigureClientService(connectionName); factory.ConfigureScopeService(connectionName); factory.ConfigureUserService(connectionName); //factory.ConfigureClientStoreCache(); //factory.ConfigureScopeStoreCache(); //factory.ConfigureUserServiceCache(); app.Map("/core1", coreApp => { var options = new IdentityServerOptions { IssuerUri = "https://" + serverName + "/identityserver", SiteName = "Identity Server Name", SigningCertificate = Cert.Load(serverName), Factory = factory, CorsPolicy = CorsPolicy.AllowAll, RequireSsl = true, EnableWelcomePage = true, AuthenticationOptions = new AuthenticationOptions { EnableLoginHint = true, EnableSignOutPrompt = false, EnableLocalLogin = false, EnablePostSignOutAutoRedirect = true, PostSignOutAutoRedirectDelay = 0, RequireAuthenticatedUserForSignOutMessage = false, RememberLastUsername = false, SignInMessageThreshold = 3, IdentityProviders = ConfigureAdditionalIdentityProviders1, CookieOptions = new Thinktecture.IdentityServer.Core.Configuration.CookieOptions() { Prefix = "Core1", SecureMode = CookieSecureMode.Always } }, LoggingOptions = new LoggingOptions { EnableHttpLogging = true, EnableWebApiDiagnostics = true, IncludeSensitiveDataInLogs = true, WebApiDiagnosticsIsVerbose = false }, EventsOptions = new EventsOptions { RaiseSuccessEvents = true, RaiseErrorEvents = true, RaiseFailureEvents = true, RaiseInformationEvents = true } }; coreApp.UseIdentityServer(options); }); app.Map("/core2", coreApp => { var options = new IdentityServerOptions { IssuerUri = "https://" + serverName + "/identityserver", SiteName = "Identity Server Name", SigningCertificate = Cert.Load(serverName), Factory = factory, CorsPolicy = CorsPolicy.AllowAll, RequireSsl = true, EnableWelcomePage = false, AuthenticationOptions = new AuthenticationOptions { EnableLoginHint = true, EnableSignOutPrompt = false, EnableLocalLogin = false, EnablePostSignOutAutoRedirect = true, PostSignOutAutoRedirectDelay = 0, RequireAuthenticatedUserForSignOutMessage = false, RememberLastUsername = false, SignInMessageThreshold = 3, IdentityProviders = ConfigureAdditionalIdentityProviders2, CookieOptions = new Thinktecture.IdentityServer.Core.Configuration.CookieOptions() { Prefix = "Core2", SecureMode = CookieSecureMode.Always } }, LoggingOptions = new LoggingOptions { EnableHttpLogging = true, EnableWebApiDiagnostics = true, IncludeSensitiveDataInLogs = true }, EventsOptions = new EventsOptions { RaiseSuccessEvents = true, RaiseErrorEvents = true, RaiseFailureEvents = true, RaiseInformationEvents = true } }; coreApp.UseIdentityServer(options); }); }