public void Configuration(IAppBuilder app) { LogProvider.SetCurrentLogProvider(new DiagnosticsTraceLogProvider()); Log.Logger = new LoggerConfiguration() .MinimumLevel.Debug() .WriteTo.Trace() .CreateLogger(); app.UseAesDataProtectorProvider(); app.Map("/admin", adminApp => { var factory = new IdentityManagerServiceFactory(); factory.ConfigureSimpleIdentityManagerService("AspId"); //factory.ConfigureCustomIdentityManagerServiceWithIntKeys("AspId_CustomPK"); var adminOptions = new IdentityManagerOptions(){ Factory = factory }; adminOptions.SecurityConfiguration.RequireSsl = false; adminApp.UseIdentityManager(adminOptions); }); var idSvrFactory = Factory.Configure(); idSvrFactory.ConfigureUserService("AspId"); var viewOptions = new ViewServiceOptions { TemplatePath = this.basePath.TrimEnd(new char[] { '/' }) }; idSvrFactory.ViewService = new IdentityServer3.Core.Configuration.Registration<IViewService>(new ViewService(viewOptions)); var options = new IdentityServerOptions { SiteName = "IdentityServer3 - ViewSerive-AspNetIdentity", SigningCertificate = Certificate.Get(), Factory = idSvrFactory, RequireSsl = false, AuthenticationOptions = new AuthenticationOptions { IdentityProviders = ConfigureAdditionalIdentityProviders, } }; app.Map("/core", core => { core.UseIdentityServer(options); }); app.UseStaticFiles(new StaticFileOptions { RequestPath = new PathString("/Content"), FileSystem = new PhysicalFileSystem(Path.Combine(this.basePath, "Content")) }); var config = new HttpConfiguration(); // config.MapHttpAttributeRoutes(); config.Routes.MapHttpRoute("API", "api/{controller}/{action}", new { controller = "Home", action = "Get" }); app.UseWebApi(config); }
public ViewService(ViewServiceOptions viewOptions) { this.viewOptions = viewOptions; rm.RegisterTemplate("~/Views/Shared/_Layout.cshtml", LoadTemplate(Path.Combine("~", "Views", "Shared", "_Layout.cshtml"))); rm.RegisterTemplate("~/Views/_ViewStart.cshtml", LoadTemplate(Path.Combine("~", "Views", "_ViewStart.cshtml"))); }
public ViewService (ViewServiceOptions viewOptions) { this.viewOptions = viewOptions; rm.RegisterTemplate ("~/Views/Shared/_Layout.cshtml", LoadTemplate (Path.Combine ("~", "Views", "Shared", "_Layout.cshtml"))); rm.RegisterTemplate ("~/Views/_ViewStart.cshtml", LoadTemplate (Path.Combine ("~", "Views", "_ViewStart.cshtml"))); }