Esempio n. 1
0
        public void Configuration(IAppBuilder app)
        {
            //Output by metering app

            /*
             * Server ready ... Press Enter to quit.
             * Response body to GET http://localhost:5000/ is 19 bytes
             * Response body to GET http://localhost:5000/files is 30058 bytes
             * Response body to GET http://localhost:5000/files/photo1 is 30058 bytes
             * Response body to GET http://localhost:5000/files/photo1.png is 507133 bytes
             * Response body to GET http://localhost:5000/api/employees/1 is 91 bytes
             */

            app.Use <MeteringMiddleware>();

            app.UseStaticFiles(new StaticFileOptions()
            {
                FileSystem  = new PhysicalFileSystem(@"D:\ASP\OwinCode\NancyDrive"),
                RequestPath = new PathString("/files"),
            });

            var config = new HttpConfiguration();

            config.Routes.MapHttpRoute("default", "api/{controller}/{id}");

            app.UseWebApi(config);

            app.UseNancy();
        }
Esempio n. 2
0
 public void Configuration(IAppBuilder app)
 {
     app.UseNancy(options =>
     {
         options.Bootstrapper = new MyNancyBootstrapper();
     });
 }
Esempio n. 3
0
        public void Configuration(IAppBuilder app)
        {
            var option = new NancyOptions
            {
                Bootstrapper = new Bootstrapper(),
                PerformPassThrough = context =>
                  context.Response.StatusCode == HttpStatusCode.NotFound
            };

            //option.PassThroughWhenStatusCodesAre(HttpStatusCode.ServiceUnavailable);
            app.UseNancy(option);
            //app.UseNancy();

            app.Map("/core",
            coreApp =>
            {
                coreApp.UseIdentityServer(new IdentityServerOptions
                {
                    SiteName = "Standalone Identity Server",
                    SigningCertificate = Certificate.Get(),
                    Factory = new IdentityServerServiceFactory()
                            .UseInMemoryClients(Clients.Get())
                            .UseInMemoryScopes(Scopes.Get())
                            .UseInMemoryUsers(Users.Get())
                });
            });
        }
Esempio n. 4
0
        public void Configuration(IAppBuilder app)
        {
            ConfigureLogger();

            var builder = new ContainerBuilder();
            builder.RegisterLogger();
            builder.RegisterByAttributes(typeof (Startup).Assembly);
            builder.RegisterAssemblyModules(typeof (Startup).Assembly);
            builder.RegisterHubs(typeof (Startup).Assembly);
            var container = builder.Build();

            // config hubs
            var config = new HubConfiguration();
            config.Resolver = new AutofacDependencyResolver(container);

            app.UseJwtTokenAuthentication(container.Resolve<IssuerSetting>(),
                                          container.Resolve<AudienceSetting>(),
                                          container.Resolve<ClientSecretSetting>(),
                                          container.Resolve<ICurrentUserProvider>());

            app.MapSignalR(config);

            app.UseNancy(new NancyOptions
            {
                Bootstrapper = new NancyBootstrapper(container)
            });
            app.UseStageMarker(PipelineStage.MapHandler);
            app.UseCors(CorsOptions.AllowAll);

            JsonSettings.RetainCasing = false;

            SeedData(container);
        }
Esempio n. 5
0
        // This code configures Web API. The Startup class is specified as a type
        // parameter in the WebApp.Start method.
        //
        public void Configuration(IAppBuilder appBuilder)
        {
            // We're going to hang the web API off off the /api "sub"-url so that we
            //  leave the root url open for the Angular 2 website.
            //
            appBuilder.Map("/api", api =>
            {
                // Create our config object we'll use to configure the API
                //
                var config = new HttpConfiguration();

                // Use attribute routing
                //
                config.MapHttpAttributeRoutes();

                // Now add in the WebAPI middleware
                //
                api.UseWebApi(config);
            });

            // Add Nancy to the OWIN pipeline.
            //  Note, because this is registered last we don't need to worry
            //  about falling-through to any other middleware. Any requests to
            //  /api/... will be handled by WebAPI first, and anything else
            //  will fall through to Nancy
            //
            appBuilder.UseNancy();
        }
Esempio n. 6
0
 public void Configuration(IAppBuilder app)
 {
     if (SetNancyFlag(app))
     {
         app.UseNancy();
     }
 }
Esempio n. 7
0
 public void Configuration(IAppBuilder app)
 {
     app.UseCors(CorsOptions.AllowAll);
     app.Use <LoggingMiddleware>();
     //app.Use<TokenMiddleware>();
     app.UseNancy();
 }
Esempio n. 8
0
 public void Configuration(IAppBuilder app)
 {
     //todo: is not working!
     //app.Use(typeof(MonitoringMiddleware), new StateValidator(1));
     //app.Use<MonitoringMiddleware>(new StateValidator(1));
     app.UseNancy();
 }
Esempio n. 9
0
        /// <summary>
        /// Adds Nancy to the OWIN pipeline.
        /// </summary>
        /// <param name="builder">The application builder.</param>
        /// <param name="configuration">A configuration builder action.</param>
        /// <returns>IAppBuilder.</returns>
        public static IAppBuilder UseNancy(this IAppBuilder builder, Action <NancyOptions> configuration)
        {
            NancyOptions nancyOptions = new NancyOptions();

            configuration(nancyOptions);
            return(builder.UseNancy(nancyOptions));
        }
Esempio n. 10
0
        public void Configuration(IAppBuilder app)
        {
            //attempt to use WebApi
            var config = new HttpConfiguration();

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
                );
            app.UseWebApi(config);

            //attempt to use SignalR
            app.MapHubs();

            //attempt to use Nancy
            app.UseNancy(new NancyBootstrapper());

            //attempt to use CustomMiddleware component - no work with Nancy
            app.Use(typeof(AddHeaderMiddleware));

            //attempt to use simple request handler - no work with Nancy
            app.UseHandlerAsync((req, res) =>
            {
                res.ContentType = "text/plain";
                return(res.WriteAsync("Hello Word!"));
            });
        }
Esempio n. 11
0
        public void Configuration(IAppBuilder app)
        {
            InitDb();

            app.ConfigureMembershipReboot();
            app.UseNancy();
        }
Esempio n. 12
0
 public void Configuration(IAppBuilder app)
 {
     app.UseNancy(new NancyOptions
     {
         Bootstrapper = new HigginsBootstrapper(new RelativePathProvider()),
     });
 }
        public void Configuration(IAppBuilder app)
        {
            var serviceBusScaleoutConfiguration = new ServiceBusScaleoutConfiguration(ConfigurationManager.ConnectionStrings["servicebus"].ConnectionString, "nancysignals")
            {
                BackoffTime = TimeSpan.FromSeconds(5)
            };

            var ioc              = new TinyIoCContainer();
            var bootstrapper     = new Bootstrapper(ioc);
            var hubConfiguration = new HubConfiguration
            {
                Resolver = bootstrapper.DependencyResolver
            };

            hubConfiguration.Resolver.UseServiceBus(serviceBusScaleoutConfiguration);
            var nancyOptions = new NancyOptions
            {
                Bootstrapper = bootstrapper
            };

            GlobalHost.DependencyResolver = bootstrapper.DependencyResolver;

            app.MapSignalR(hubConfiguration);
            app.UseNancy(nancyOptions);
        }
Esempio n. 14
0
        public void Configuration(IAppBuilder app)
        {
            app.UseDebugMiddleware(options =>
            {
                var stopwatch = new Stopwatch();

                options.IncomingRequest += (sender, args) =>
                {
                    stopwatch.Start();

                    Debug.WriteLine($"Incoming request for {args.Context.Request.Uri.AbsolutePath}", "INFO");
                };

                options.OutgoingRequest += (sender, args) =>
                {
                    Debug.WriteLine($"Outgoing request for {args.Context.Request.Uri.AbsolutePath}", "INFO");

                    stopwatch.Stop();

                    Debug.WriteLine($"It has passed {stopwatch.ElapsedMilliseconds} ms", "INFO");

                    stopwatch.Restart();
                };
            });

            app.UseNancy();
        }
Esempio n. 15
0
 public void Configuration(IAppBuilder app)
 {
     app.Use<LoggingMiddleware>();
     // Commenting the next line will fix the issue.
     app.UseJwtBearerAuthentication(CreateJwtBearerAuthOptions());
     app.UseNancy();
 }
 public void Configuration(IAppBuilder app)
 {
     app.UseNancy(new NancyOptions
     {
         Bootstrapper = new Bootstrapper()
     });
 }
Esempio n. 17
0
        public void Configuration(IAppBuilder appBuilder)
        {
            // Configure Web API for self-host.
            HttpConfiguration config = new HttpConfiguration();

            var    loDummyType = typeof(Abraxas.Scheduler.Core.Controllers.JobController);
            string lsTypeName  = loDummyType.FullName;

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{action}/{id}",
                defaults: new { id = RouteParameter.Optional }
                );

            //Json Output erzwingen
            var appXmlType = config.Formatters.XmlFormatter.SupportedMediaTypes.FirstOrDefault(t => t.MediaType == "application/xml");

            config.Formatters.XmlFormatter.SupportedMediaTypes.Remove(appXmlType);

            config.EnableSwagger(c =>
            {
                //c.RootUrl(req => "http://localhost:9788/api");
                c.SingleApiVersion("v1", "abr Scheduler");
            }).EnableSwaggerUi();

            appBuilder.UseWebApi(config);

            appBuilder.UseNancy();
        }
Esempio n. 18
0
        // This code configures Web API. The Startup class is specified as a type
        // parameter in the WebApp.Start method.
        public void Configuration(IAppBuilder appBuilder)
        {
            // Configure Web API for self-host.
            HttpConfiguration loConfig = new HttpConfiguration();

            loConfig.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{action}",
                defaults: new { id = RouteParameter.Optional }
                );

            //Json Output erzwingen
            var appXmlType = loConfig.Formatters.XmlFormatter.SupportedMediaTypes.FirstOrDefault(t => t.MediaType == "application/xml");

            loConfig.Formatters.XmlFormatter.SupportedMediaTypes.Remove(appXmlType);

            appBuilder.UseWebApi(loConfig);

            appBuilder.MapSignalR(new Microsoft.AspNet.SignalR.HubConfiguration()
            {
                EnableDetailedErrors = true
            });

            appBuilder.UseNancy();
        }
Esempio n. 19
0
        public void Configuration(IAppBuilder app)
        {
            app.UseErrorPage();

            app.Use((context, func) =>
            {
                if (!context.Request.PathBase.HasValue)
                {
                    context.Request.Path     = new PathString("/");
                    context.Request.PathBase = new PathString("/api");
                }

                return(func());
            });

            app.MapConnection <MessageStreamerConnection>("/messagestream",
                                                          new ConnectionConfiguration
            {
                EnableCrossDomain = true,
            });

            app.UseNancy(new NancyOptions {
                Bootstrapper = new NServiceBusContainerBootstrapper()
            });
        }
        public void Configuration(IAppBuilder app)
        {
            app.UseNancy();
            app.UseStageMarker(PipelineStage.MapHandler);

            Mapper.Initialize(config => config.AddProfiles(Assembly.GetExecutingAssembly()));
        }
        public void Configuration(IAppBuilder app)
        {
            ConfigureAuth(app);
            app.UseNancy();

            // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=316888
        }
Esempio n. 22
0
        public void Configuration(IAppBuilder app)
        {
            var settings = new JsonSerializerSettings
            {
                DateFormatHandling   = DateFormatHandling.MicrosoftDateFormat,
                DateParseHandling    = DateParseHandling.DateTime,
                DateTimeZoneHandling = DateTimeZoneHandling.RoundtripKind
            };

            settings.Converters.Add(new DoubleConverter());

            GlobalHost.DependencyResolver.Register(typeof(JsonSerializer), () => JsonSerializer.Create(settings));

            var hubConfiguration = new HubConfiguration();

#if DEBUG
            hubConfiguration.EnableDetailedErrors    = true;
            StaticConfiguration.EnableRequestTracing = true;
            StaticConfiguration.DisableErrorTraces   = false;
            StaticConfiguration.Caching.EnableRuntimeViewDiscovery = true;
            StaticConfiguration.Caching.EnableRuntimeViewUpdates   = true;
#endif
            app.MapSignalR(hubConfiguration);
            app.UseNancy();
        }
Esempio n. 23
0
        // This code configures Web API. The Startup class is specified as a type
        // parameter in the WebApp.Start method.
        //
        public void Configuration(IAppBuilder appBuilder)
        {
            // We're going to hang the web API off off the /api "sub"-url so that we
            //  leave the root url open for the Angular 2 website.
            //
            appBuilder.Map("/api", api =>
            {
                // Create our config object we'll use to configure the API
                //
                var config = new HttpConfiguration();

                // Use attribute routing
                //
                config.MapHttpAttributeRoutes();

                api.MapWebSocketPattern <MidiInputWebSocket>("/midi-devices/inputs/(?<inputName>.+)/ws");
                api.MapWebSocketPattern <MidiOutputWebSocket>("/midi-devices/outputs/(?<outputName>.+)/ws");

                config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();

                // Now add in the WebAPI middleware
                //
                api.UseWebApi(config);
            });

            // Add Nancy to the OWIN pipeline.
            //  Note, because this is registered last we don't need to worry
            //  about falling-through to any other middleware. Any requests to
            //  /api/... will be handled by WebAPI first, and anything else
            //  will fall through to Nancy
            //

            appBuilder.UseNancy();
        }
Esempio n. 24
0
        public static void Configuration(IAppBuilder app)
        {
            app.UseDebugMiddleware(new DebugMiddlewareOptions
            {
                OnIncomingRequest = (ctx) =>
                {
                    var watch = new Stopwatch();
                    watch.Start();
                    ctx.Environment["DebugStopwatch"] = watch;
                },

                OnOutgoingRequest = (ctx) =>
                {
                    var watch = (Stopwatch)ctx.Environment["DebugStopwatch"];
                    watch.Stop();
                    Debug.WriteLine("Request took: " + watch.ElapsedMilliseconds + " ms");
                }
            });

            var config = new HttpConfiguration();

            config.MapHttpAttributeRoutes();
            app.UseWebApi(config);

            // app.Map("/nancy", mappedApp => { mappedApp.UseNancy(); });
            app.UseNancy(conf => {
                conf.PassThroughWhenStatusCodesAre(HttpStatusCode.NotFound);
            });

            app.Use(async(ctx, next) => {
                await ctx.Response.WriteAsync("<html><head></head><body>Hello World</body></html>");
            });
        }
Esempio n. 25
0
        public void Configuration(IAppBuilder app)
        {
            app.Use((ctx, next) =>
            {
                var output = ctx.Get<TextWriter>("host.TraceOutput");
                output.WriteLine("{0} {1}: {2}", ctx.Request.Scheme, ctx.Request.Method, ctx.Request.Path);
                return next();
            });
            GlobalHost.DependencyResolver.Register(typeof(VoteHub),
                () => new VoteHub(new QuestionRepository()));

            app.UseStaticFiles();
            app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
            //app.MapSignalR();
            app.Map("/signalr", map => map.UseCors(CorsOptions.Value)
                 .RunSignalR(new HubConfiguration
                 {
                     EnableJSONP = true
                 }));

            app.UseNancy(options =>
                    options.PerformPassThrough = context =>
                        context.Response.StatusCode == HttpStatusCode.NotFound);
            
            app.Run(context =>
            {
                context.Response.ContentType = "text/plain";
                return context.Response.WriteAsync("Hello World!");
            });
        }
 public void Configure(IAppBuilder builder, IOwinHostingContext context)
 {
     builder.UseNancy(new NancyOptions
     {
         Bootstrapper = _nancyBootstrapper
     });
 }
Esempio n. 27
0
        public void Configuration(IAppBuilder app)
        {
            try
            {
                Debug.WriteLine("Starting StartupConfiguration");
                var resolver = new DependancyResolver();

                Debug.WriteLine("Created DI Resolver");
                var modules = resolver.GetModules();
                Debug.WriteLine("Getting all the modules");


                Debug.WriteLine("Modules found finished.");
                var kernel = new StandardKernel(modules);
                Debug.WriteLine("Created Kernel and Injected Modules");

                Debug.WriteLine("Added Contravariant Binder");
                kernel.Components.Add <IBindingResolver, ContravariantBindingResolver>();

                Debug.WriteLine("Start the bootstrapper with the Kernel.ı");
                app.UseNancy(options => options.Bootstrapper = new Bootstrapper(kernel));
                Debug.WriteLine("Finished bootstrapper");
                var scheduler = new Scheduler();
                scheduler.StartScheduler();
            }
            catch (Exception exception)
            {
                Log.Fatal(exception);
                throw;
            }
        }
Esempio n. 28
0
        public void Configuration(IAppBuilder app)
        {
            // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888

            // Static file support.
            var baseDir = AppDomain.CurrentDomain.BaseDirectory;
            app.UseStaticFiles(new StaticFileOptions
            {
                FileSystem = new PhysicalFileSystem(root: baseDir),
                ServeUnknownFileTypes = false
            });

            // ASP.NET Web API support.
            var config = new HttpConfiguration();
            
            // Fix: CORS support of WebAPI doesn't work on mono. http://stackoverflow.com/questions/31590869/web-api-2-post-request-not-working-on-mono
            if (Type.GetType("Mono.Runtime") != null) config.MessageHandlers.Add(new MonoPatchingDelegatingHandler());

            config.EnableCors();
            config.MapHttpAttributeRoutes();
            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );
            app.UseWebApi(config);

            // NancyFx support.
            app.UseNancy();
        }
Esempio n. 29
0
 public void Configuration(IAppBuilder app)
 {
     Common.Setup.AutoMapper.Initialize();
     app.MapSignalR();
     app.UseNancy();
     app.UseStageMarker(PipelineStage.MapHandler);
 }    
Esempio n. 30
0
        public void Configuration(IAppBuilder app)
        {
            JwtSecurityTokenHandler.InboundClaimTypeMap.Clear();

            app.UseIdentityServerBearerTokenAuthentication(new IdentityServerBearerTokenAuthenticationOptions
            {
                Authority = "https://localhost:44333/core",
                RequiredScopes = new[] { "api" },
                NameClaimType = "name",
                RoleClaimType = "role",

                // client credentials for the introspection endpoint
                ClientId = "angularMaterial",
                ClientSecret = Guid.NewGuid().ToString()
            });

            var configuration = new HttpConfiguration();
            configuration.MapHttpAttributeRoutes();

            var jsonFormatter = configuration.Formatters.OfType<JsonMediaTypeFormatter>().FirstOrDefault();

            if (jsonFormatter != null)
            {
                jsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
            }

            app.UseResourceAuthorization(new AuthorizationManager());

            app.UseWebApi(configuration);

            app.UseNancy();
            app.UseStageMarker(PipelineStage.MapHandler);
        }
Esempio n. 31
0
        public void Configuration(IAppBuilder app)
        {
            var listener = (HttpListener)app.Properties["System.Net.HttpListener"];

            listener.AuthenticationSchemes = AuthenticationSchemes.IntegratedWindowsAuthentication;
            app.UseNancy();
        }
 public void Configuration(IAppBuilder app)
 {
     app.UseNancy();
     // todo: uncomment to invoke non-default Bootstrapper ctor
     //app.UseNancy(new NancyOptions() { Bootstrapper = new CustomBootstrapper(str: "hi") });
     app.UseStageMarker(PipelineStage.MapHandler);//required to display Nancy assets on IIS
 }
        public static void Configure(IAppBuilder app, IContainer container)
        {
            var webConfiguration = new WebConfiguration();

            string absolutePath = null;
            if (webConfiguration.NancyViewPath != null)
            {
                var isPathRooted = Path.IsPathRooted(webConfiguration.NancyViewPath);
                if (isPathRooted)
                {
                    absolutePath = webConfiguration.NancyViewPath;
                }
                else
                {
                    var baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
                    absolutePath = Path.Combine(baseDirectory, webConfiguration.NancyViewPath);
                    absolutePath = Path.GetFullPath(absolutePath);
                }
            }

            AutofacNancyBootstrapper.RootPath = absolutePath;
            AutofacNancyBootstrapper.Container = container;

            app.UseNancy(new NancyOptions
            {
                PerformPassThrough = context => context.Response.StatusCode == HttpStatusCode.NotFound
            });
        }
 public void Configuration(IAppBuilder app)
 {
     app.UseNancy(x =>
     {
         x.Bootstrapper = new CustomConventionsNancy();
     });
 }
Esempio n. 35
0
        public void Configuration(IAppBuilder app)
        {
            var options = new NancyOptions();

            options.Bootstrapper = new Bootstrapper();
            app.UseNancy();
        }
Esempio n. 36
0
 public void Configuration(IAppBuilder app)
 {
     app.UseNancy(new Nancy.Owin.NancyOptions
     {
         Bootstrapper = new DefaultNancyBootstrapper()
     });
 }
Esempio n. 37
0
 public void Configuration(IAppBuilder app)
 {
     var hubConfig = new HubConfiguration();
       hubConfig.EnableDetailedErrors = true;
       app.MapSignalR(hubConfig);
       app.UseNancy();
 }
Esempio n. 38
0
 public void Configuration(IAppBuilder app)
 {
     app.UseNancy(options =>
     {
         options.Bootstrapper = new Bootstrapper();
     });
 }
Esempio n. 39
0
        public void Configuration(IAppBuilder appBuilder)
        {
            // Host all the WebAPI components underneath a path so we can
            //  easily deploy a traditional site at the root of the web
            //  application
            //
            appBuilder.Map("/api", api =>
            {
                // This object is what we use to configure the behavior
                //  of WebAPI in our application
                //
                var httpConfiguration = new HttpConfiguration();

                // We'll use attribute based routing instead of the
                //  convention-based approach
                //
                httpConfiguration.MapHttpAttributeRoutes();

                // Change the serialization so it does camelCase
                //
                var jsonFormatter = httpConfiguration.Formatters.JsonFormatter;
                var settings = jsonFormatter.SerializerSettings;
                settings.ContractResolver = new CamelCasePropertyNamesContractResolver();

                // Now add in web api to the OWIN pipeline
                //
                api.UseWebApi(httpConfiguration);
            });

            // Add nancy to the pipeline after WebAPI so the API can
            //  handle any requests it is configured for first
            //
            appBuilder.UseNancy();
        }
Esempio n. 40
0
        public void Configuration(IAppBuilder app)
        {
            app.Use((ctx, next) =>
            {
                var output = ctx.Get <TextWriter>("host.TraceOutput");
                output.WriteLine("{0} {1}: {2}", ctx.Request.Scheme, ctx.Request.Method, ctx.Request.Path);
                return(next());
            });
            GlobalHost.DependencyResolver.Register(typeof(VoteHub),
                                                   () => new VoteHub(new QuestionRepository()));

            app.UseStaticFiles();
            app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
            //app.MapSignalR();
            app.Map("/signalr", map => map.UseCors(CorsOptions.Value)
                    .RunSignalR(new HubConfiguration
            {
                EnableJSONP = true
            }));

            app.UseNancy(options =>
                         options.PerformPassThrough = context =>
                                                      context.Response.StatusCode == HttpStatusCode.NotFound);

            app.Run(context =>
            {
                context.Response.ContentType = "text/plain";
                return(context.Response.WriteAsync("Hello World!"));
            });
        }
Esempio n. 41
0
 public void Configuration(IAppBuilder app)
 {
     app.UseNancy(new Nancy.Owin.NancyOptions
     {
         Bootstrapper = new DefaultNancyBootstrapper()
     });
 }
Esempio n. 42
0
        // This code configures Web API. The Startup class is specified as a type
        // parameter in the WebApp.Start method.
        //
        public void Configuration(IAppBuilder appBuilder)
        {
            // We're going to hang the web API off off the /api "sub"-url so that we
            //  leave the root url open for the Angular 2 website.
            //
            appBuilder.Map("/api", api =>
            {
                // Create our config object we'll use to configure the API
                //
                var config = new HttpConfiguration();

                // Use attribute routing
                //
                config.MapHttpAttributeRoutes();

                // Now add in the WebAPI middleware
                //
                api.UseWebApi(config);
            });

            // Add Nancy to the OWIN pipeline.
            //  Note, because this is registered last we don't need to worry
            //  about falling-through to any other middleware. Any requests to
            //  /api/... will be handled by WebAPI first, and anything else
            //  will fall through to Nancy
            //
            appBuilder.UseNancy();
        }
Esempio n. 43
0
        public void Configuration(IAppBuilder app)
        {
            HttpConfiguration config = ConfigureWebApi();

            app.UseWebApi(config);
            app.UseNancy();
        }
Esempio n. 44
0
        public void Configuration(IAppBuilder appBuilder)
        {
            // Host all the WebAPI components underneath a path so we can
            //  easily deploy a traditional site at the root of the web
            //  application
            //
            appBuilder.Map("/api", api =>
            {
                // This object is what we use to configure the behavior
                //  of WebAPI in our application
                //
                var httpConfiguration = new HttpConfiguration();

                // We'll use attribute based routing instead of the
                //  convention-based approach
                //
                httpConfiguration.MapHttpAttributeRoutes();

                // Change the serialization so it does camelCase
                //
                var jsonFormatter         = httpConfiguration.Formatters.JsonFormatter;
                var settings              = jsonFormatter.SerializerSettings;
                settings.ContractResolver = new CamelCasePropertyNamesContractResolver();

                // Now add in web api to the OWIN pipeline
                //
                api.UseWebApi(httpConfiguration);
            });

            // Add nancy to the pipeline after WebAPI so the API can
            //  handle any requests it is configured for first
            //
            appBuilder.UseNancy();
        }
		public void Configuration(IAppBuilder app)
		{
			app.UseNancy(x =>
			{
				x.Bootstrapper = new CustomConventionsNancy();
			});
		}
Esempio n. 46
0
        public void Configuration(IAppBuilder app)
        {
            JwtSecurityTokenHandler.InboundClaimTypeMap.Clear();

            app.UseIdentityServerBearerTokenAuthentication(new IdentityServerBearerTokenAuthenticationOptions
            {
                Authority      = "https://localhost:44333/core",
                RequiredScopes = new[] { "api" },
                NameClaimType  = "name",
                RoleClaimType  = "role",

                // client credentials for the introspection endpoint
                ClientId     = "angularMaterial",
                ClientSecret = Guid.NewGuid().ToString()
            });

            var configuration = new HttpConfiguration();

            configuration.MapHttpAttributeRoutes();

            var jsonFormatter = configuration.Formatters.OfType <JsonMediaTypeFormatter>().FirstOrDefault();

            if (jsonFormatter != null)
            {
                jsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
            }

            app.UseResourceAuthorization(new AuthorizationManager());

            app.UseWebApi(configuration);

            app.UseNancy();
            app.UseStageMarker(PipelineStage.MapHandler);
        }
Esempio n. 47
0
        public void Configuration(IAppBuilder app)
        {
            var configuration = new ConfigurationBuilder()
                                .AddJsonFile("appsettings.json")
                                .Add(new WebConfigProvider())
                                .Build();
            var _certificateService = new WindowsCertificateService();
            var decryptionService   = new DecryptionService(_certificateService);

            var appConfig = new AppConfiguration();

            ConfigurationBinder.Bind(configuration, appConfig);

            var provider = new IdentityProviderSearchServiceConfigurationProvider(appConfig.EncryptionCertificateSettings, decryptionService);

            provider.GetAppConfiguration(appConfig);

            var logger = LogFactory.CreateTraceLogger(new LoggingLevelSwitch(), appConfig.ApplicationInsights);

            logger.Information("IdentityProviderSearchService is starting up...");

            appConfig.ConfigureIdentityServiceUrl();

            app.UseIdentityServerBearerTokenAuthentication(new IdentityServerBearerTokenAuthenticationOptions
            {
                Authority      = appConfig.IdentityServerConfidentialClientSettings.Authority,
                RequiredScopes = appConfig.IdentityServerConfidentialClientSettings.Scopes
            });

            app.UseNancy(opt => opt.Bootstrapper = new Bootstrapper(appConfig, logger));
            app.UseStageMarker(PipelineStage.MapHandler);
        }
Esempio n. 48
0
 public IAppBuilder Configure(IAppBuilder app, IHealthNetConfiguration healthNetConfiguration, IEnumerable<ISystemChecker> checkers)
 {
     return app
         .UseNancy(x =>
             x.Bootstrapper =
                 new ConfigurableBootstrapper(
                     y => y.Module<HealthNetModule>().Module<FooModule>().DisableAutoRegistrations().Dependency(checkers).Dependency(healthNetConfiguration)));
 }
Esempio n. 49
0
        public void Configuration(IAppBuilder app)
        {
            app.UseNancy();

            var container = new Container();
            container.Register<IRepository, JustEatRepository>(Lifestyle.Singleton);
            container.Verify();
        }
Esempio n. 50
0
        public void Configuration(IAppBuilder app)
        {
            #if !DEBUG
            app.RequiresHttps(new RequiresHttpsOptions());
            #endif

            app.UseNancy();
        }
Esempio n. 51
0
      public void Configuration(IAppBuilder app)
      {
         app.MapSignalR();
         app.UseNancy();

         VMController.RegisterAssembly(typeof(HomeModule).Assembly);
         VMController.RegisterAssembly(typeof(ExamplesLibrary.TreeViewVM).Assembly);
      }
Esempio n. 52
0
 public void Configuration(IAppBuilder app)
 {
     app.UseNancy(new Nancy.Owin.NancyOptions
     {
         Bootstrapper = BootstrapperFunc.Invoke(),
         EnableClientCertificates = true
     });
 }
Esempio n. 53
0
        public void Configuration(IAppBuilder app)
        {
            app.UseErrorPage();

            app.MapSignalR();

            app.UseNancy();
        }
 public void Configuration(IAppBuilder app)
 {
     var config = new HttpConfiguration();
     config.MapHttpAttributeRoutes();
     app.UseWebApi(config);
     app.UseNancy();
     app.UseStageMarker(PipelineStage.MapHandler);
 }
Esempio n. 55
0
	public void Configuration(IAppBuilder app)
	{
		// set the AI key
		Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.Active.InstrumentationKey =
				ConfigurationManager.AppSettings["AiInstrumentationKey"];

		app.UseNancy();
		app.UseStageMarker(PipelineStage.MapHandler);
	}
Esempio n. 56
0
        public void Configuration(IAppBuilder app)
        {
            app.UseNancy(new NancyOptions
            {
                Bootstrapper = new Bootstrapper(Helper.GetConfiguredContainer().Resolve<IRobot>())
            });

            StaticConfiguration.DisableErrorTraces = false;
        }
        public void Configuration(IAppBuilder app)
        {
            // Map the hubs first, otherwise Nancy grabs them and you get a 404.
            var configuration = new HubConfiguration { EnableDetailedErrors = true };
            app.MapHubs(configuration);

            var bootstrapper = new Bootstrapper();
            app.UseNancy(bootstrapper);
        }
Esempio n. 58
0
 public void Configuration(IAppBuilder app)
 {
     app
         .UseNancy(new NancyOptions
         {
             Bootstrapper = new Bootstrapper()
         })
         .UseStageMarker(PipelineStage.MapHandler);
 }
Esempio n. 59
0
 public void Configuration(IAppBuilder app)
 {
     ConfigureApi(app);
     app.UseNancy(new NancyOptions { Bootstrapper = new NancyBootstrapper() });
     app.UseHandlerAsync((req, res) =>
     {
         res.ContentType = "text/plain";
         return res.WriteAsync("OWIN Web Application Final step");
     });
 }