Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 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")));
 }
Ejemplo n.º 3
0
		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")));
		}