public static void UseIdentityServerCustomStoreSetup(this IAppBuilder app) { LogProvider.SetCurrentLogProvider(new SimpleDiagnosticLoggerProvider(AppDomain.CurrentDomain.SetupInformation.ApplicationBase)); LogProvider.GetCurrentClassLogger().Log(IdentityServer3.Core.Logging.LogLevel.Info, () => { return("Starting up custom store implementation..."); }); var requireSsl = true; #if DEBUG requireSsl = false; #endif app.Map("/Identity", idApp => { var options = new IdentityServerOptions { SiteName = "Glavs Secret Identity Server", RequireSsl = requireSsl, IssuerUri = "http://AuthOmeSite.com", SigningCertificate = CertificateLoader.LoadCertificate(), LoggingOptions = GetFullLoggingConfig(), Factory = new IdentityServerServiceFactory(), EnableWelcomePage = true }; // View options for things like consent form var viewOptions = new DefaultViewServiceOptions(); viewOptions.Stylesheets.Add("/Content/IdentityServer/CustomIdentityServerStyles.css"); viewOptions.CustomViewDirectory = string.Format("{0}\\Content\\IdentityServer", AppDomain.CurrentDomain.BaseDirectory); options.Factory.CorsPolicyService = new Registration <ICorsPolicyService>(new DefaultCorsPolicyService { AllowAll = true }); options.EnableWelcomePage = false; #if DEBUG options.EnableWelcomePage = true; #endif #if DEBUG viewOptions.CacheViews = false; #endif options.Factory.ConfigureDefaultViewService(viewOptions); // Entity framework data persistence //var efConfig = new EntityFrameworkServiceOptions //{ // ConnectionString = "IdSvr3Config", // Schema = "Identity" //}; //options.Factory.RegisterOperationalServices(efConfig); SetupCustomImplementationHooks(options); idApp.UseIdentityServer(options); }); }
public static void UseIdentityServerCustomStoreWithOpenIdMvcSetup(this IAppBuilder app) { LogProvider.SetCurrentLogProvider(new SimpleDiagnosticLoggerProvider(AppDomain.CurrentDomain.SetupInformation.ApplicationBase)); LogProvider.GetCurrentClassLogger().Log(IdentityServer3.Core.Logging.LogLevel.Info, () => { return("Starting up custom store implementation..."); }); var requireSsl = true; #if DEBUG requireSsl = false; #endif app.Map("/Identity", idApp => { var options = new IdentityServerOptions { SiteName = "Glavs Secret Identity Server", RequireSsl = requireSsl, IssuerUri = "http://AuthOmeSite.com", SigningCertificate = CertificateLoader.LoadCertificate(), LoggingOptions = GetFullLoggingConfig(), Factory = new IdentityServerServiceFactory(), EnableWelcomePage = true, AuthenticationOptions = new AuthenticationOptions { CookieOptions = new IdentityServer3.Core.Configuration.CookieOptions { AllowRememberMe = true, IsPersistent = false, RememberMeDuration = TimeSpan.FromMinutes(1), }, EnableSignOutPrompt = false }, }; // View options for things like consent form SetFactoryAndViewOpptions(options); SetupCustomImplementationHooks(options); idApp.UseIdentityServer(options); }); app.UseCookieAuthentication(new Microsoft.Owin.Security.Cookies.CookieAuthenticationOptions { AuthenticationType = "Cookies", }); app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions { Authority = "http://localhost:35373/identity", ClientId = "mvc", RedirectUri = "http://localhost:35373/", ResponseType = "id_token", SignInAsAuthenticationType = "Cookies" }); }
public static void UseIdentityServerCustomViewSetup(this IAppBuilder app) { LogProvider.SetCurrentLogProvider(new SimpleDiagnosticLoggerProvider(AppDomain.CurrentDomain.SetupInformation.ApplicationBase)); LogProvider.GetCurrentClassLogger().Log(IdentityServer3.Core.Logging.LogLevel.Info, () => { return("Starting up custom view implementation..."); }); var requireSsl = true; #if DEBUG requireSsl = false; #endif app.Map("/Identity", idApp => { var options = new IdentityServerOptions { SiteName = "Glavs Secret Identity Server", RequireSsl = requireSsl, IssuerUri = "http://AuthOmeSite.com", SigningCertificate = CertificateLoader.LoadCertificate(), LoggingOptions = GetFullLoggingConfig(), Factory = GetInMemoryFactoryOptions(), EnableWelcomePage = true }; // View options for things like consent form var viewOptions = new DefaultViewServiceOptions(); viewOptions.Stylesheets.Add("/Content/IdentityServer/CustomIdentityServerStyles.css"); viewOptions.CustomViewDirectory = string.Format("{0}\\Content\\IdentityServer", AppDomain.CurrentDomain.BaseDirectory); #if DEBUG viewOptions.CacheViews = false; #endif options.Factory.ConfigureDefaultViewService(viewOptions); idApp.UseIdentityServer(options); }); }