Ejemplo n.º 1
0
        public void Configuration(IAppBuilder app)
        {
            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel.Debug()
                         .WriteTo.File(@"c:\logs\log.txt", rollingInterval: RollingInterval.Day)
                         .WriteTo.Debug()
                         .CreateLogger();


            Log.Logger.Write(LogEventLevel.Debug, "test");

            /* Asp.Net Identity Configurations*/
            // https://stackoverflow.com/questions/42563647/how-to-register-applicationusermanager-with-identityserver-di-framework
            DataProtectionProvider = app.GetDataProtectionProvider();



            /*
             * Project -> No Template / Mvc ref
             * Add web.config runAllManagedModulesForAllRequests
             *
             * install-package Microsoft.Owin.Host.Systemweb
             * install-package IdentityServer3
             */
            app.Map("/identity", idsrvApp =>
            {
                idsrvApp.UseIdentityServer(new IdentityServerOptions
                {
                    SiteName           = "IdentityServer",
                    EnableWelcomePage  = false,
                    SigningCertificate = LoadCertificate(),

                    Factory = ServiceFactory.Configure(),
                    AuthenticationOptions = new AuthenticationOptions
                    {
                        EnablePostSignOutAutoRedirect = true,
                        LoginPageLinks = new List <LoginPageLink>()
                        {
                            new LoginPageLink()
                            {
                                Type = "createaccount",
                                Text = "Create a new account",
                                Href = "~/account"
                            },
                            new LoginPageLink()
                            {
                                Type = "forgotpassword",
                                Text = "Forgot password",
                                Href = "~/account/forgotpassword"
                            }
                        }
                    }
                });
            });
        }
Ejemplo n.º 2
0
 private static void ConfigureServices(HostBuilderContext context, IServiceCollection services)
 {
     Container = services;
     if (context.HostingEnvironment.IsDevelopment())
     {
         ServiceFactory.ConfigureMock(services);
     }
     else
     {
         ServiceFactory.Configure(services);
     }
 }