当前位置: 首页>>代码示例>>C#>>正文


C# IPipelines.EnableBasicAuthentication方法代码示例

本文整理汇总了C#中IPipelines.EnableBasicAuthentication方法的典型用法代码示例。如果您正苦于以下问题:C# IPipelines.EnableBasicAuthentication方法的具体用法?C# IPipelines.EnableBasicAuthentication怎么用?C# IPipelines.EnableBasicAuthentication使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPipelines的用法示例。


在下文中一共展示了IPipelines.EnableBasicAuthentication方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ApplicationStartup

        protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
        {
            base.ApplicationStartup(container, pipelines);

            var announcer = new NullAnnouncer();
            var assembly = Assembly.GetExecutingAssembly();

            var migrationContext = new RunnerContext(announcer)
            {
                Namespace = "Server.Migrations"
            };

            var options = new MigrationOptions();
            var factory = new FluentMigrator.Runner.Processors.SqlServer.SqlServer2008ProcessorFactory();
            var processor = factory.Create(
                ConfigurationManager.ConnectionStrings["Simple.Data.Properties.Settings.DefaultConnectionString"].ConnectionString,
                announcer,
                options);
            var runner = new MigrationRunner(assembly, migrationContext, processor);
            runner.MigrateUp(true);

            pipelines.EnableBasicAuthentication(new BasicAuthenticationConfiguration(new UserValidator(), "CPNRealm"));

            JsonSettings.RetainCasing = true;

            StaticConfiguration.DisableErrorTraces = false;
        }
开发者ID:ChristopherMeek,项目名称:CornishPlaceNames,代码行数:27,代码来源:MigratingBootstrapper.cs

示例2: ApplicationStartup

 protected override void ApplicationStartup(TinyIoC.TinyIoCContainer container, IPipelines pipelines)
 {
     base.ApplicationStartup(container, pipelines);
     pipelines.EnableBasicAuthentication(new BasicAuthenticationConfiguration(
         container.Resolve<IUserValidator>(),
         "NancyFx"));
 }
开发者ID:seun104,项目名称:AgbaraVOIP,代码行数:7,代码来源:AuthenticationBootstrapper.cs

示例3: ApplicationStartup

        protected override void ApplicationStartup(TinyIoC.TinyIoCContainer container, IPipelines pipelines)
        {
            base.ApplicationStartup(container, pipelines);

            pipelines.EnableBasicAuthentication(new BasicAuthenticationConfiguration(
                                                    container.Resolve<IUserValidator>(),
                                                    "RateAllTheThings"));

            pipelines.OnError += (context, exception) =>
            {
                exception.SendToAirbrake();
                return null;
            };
        }
开发者ID:FredrikL,项目名称:RateAllTheThingsBackend,代码行数:14,代码来源:RateAllTheThingsBootstrapper.cs

示例4: Register

        public void Register(IPipelines pipelines)
        {
            if (_configFileProvider.AuthenticationMethod == AuthenticationType.Forms)
            {
                RegisterFormsAuth(pipelines);
            }

            else if (_configFileProvider.AuthenticationMethod == AuthenticationType.Basic)
            {
                pipelines.EnableBasicAuthentication(new BasicAuthenticationConfiguration(_authenticationService, "Sonarr"));
            }

            pipelines.BeforeRequest.AddItemToEndOfPipeline((Func<NancyContext, Response>) RequiresAuthentication);
            pipelines.AfterRequest.AddItemToEndOfPipeline((Action<NancyContext>) RemoveLoginHooksForApiCalls);
        }
开发者ID:drewfreyling,项目名称:NzbDrone,代码行数:15,代码来源:EnableAuthInNancy.cs

示例5: ApplicationStartup

        protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
        {
            base.ApplicationStartup(container, pipelines);

            pipelines.EnableBasicAuthentication(new BasicAuthenticationConfiguration(
                        container.Resolve<IUserValidator>(),
                        "Couchbase XDCR"));

            StaticConfiguration.EnableRequestTracing = true;

            NancyInternalConfiguration.WithOverrides(c =>
                {
                    c.StatusCodeHandlers.Clear();
                    c.StatusCodeHandlers.Add(typeof(StatusCodeHandler));
                }
            );

            container.Register<IReplicationHandler>(new XmlReplicator());
        }
开发者ID:brettveenstra,项目名称:couchbase-xdcr-nancy,代码行数:19,代码来源:ApplicationBootstrapper.cs

示例6: ApplicationStartup

        protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
        {
            PerformanceData.Run();

            var host = TinyIoCContainer.Current.Resolve<IHost>();

            pipelines.EnableBasicAuthentication(new BasicAuthenticationConfiguration(container.Resolve<IUserValidator>(), "Servant"));
            CookieBasedSessions.Enable(pipelines);
            
            var sw = new Stopwatch();

            pipelines.BeforeRequest.InsertBefore("DebuggingStart", nancyContext => 
            {
                sw.Reset();
                sw.Start();
                
                return nancyContext.Response;
            });
            
            // Irriterede mig at den ikke returnerede UTF8
            pipelines.AfterRequest.InsertAfter("EncodingFix", nancyContext =>
            {
                if (nancyContext.Response.ContentType == "text/html")
                    nancyContext.Response.ContentType = "text/html; charset=utf8";
            });

            pipelines.AfterRequest.InsertAfter("DebuggingEnd", ctx =>
            {
                sw.Stop();
                if (host.Debug)
                {
                    Console.ForegroundColor = ConsoleColor.DarkGray;
                    Console.WriteLine(DateTime.Now.ToLongTimeString() + ": " + ctx.Request.Method + " " + ctx.Request.Url + "(" + sw.ElapsedMilliseconds + "ms)");
                    Console.ResetColor();
                }
            });

            base.ApplicationStartup(container, pipelines);
        }
开发者ID:ohde,项目名称:servant,代码行数:39,代码来源:Bootstrapper.cs

示例7: ApplicationStartup

        protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
        {
            base.ApplicationStartup(container, pipelines);

            pipelines.EnableBasicAuthentication(new BasicAuthenticationConfiguration(new UserValidator(), "Nusharp", UserPromptBehaviour.Always));
        }
开发者ID:modulexcite,项目名称:Nusharp,代码行数:6,代码来源:NusharpBootstrapper.cs

示例8: ApplicationStartup

 protected override void ApplicationStartup(TinyIoC.TinyIoCContainer container, IPipelines pipeline)
 {
     container.Register<IAccountService, AccountService>().AsSingleton();
     base.ApplicationStartup(container, pipeline);
     pipeline.EnableBasicAuthentication(new BasicAuthenticationConfiguration(container.Resolve<IUserValidator>(),"AgbaraVOIP"));
 }
开发者ID:seun104,项目名称:AgbaraVOIP,代码行数:6,代码来源:AuthenticationBootstrapper.cs

示例9: ApplicationStartup

			protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
			{
				base.ApplicationStartup(container, pipelines);

				var configuration = new BasicAuthenticationConfiguration(
					container.Resolve<IUserValidator>(),
						"MessageVault"
						);
				pipelines.EnableBasicAuthentication(configuration);
			}
开发者ID:perokvist,项目名称:messageVault,代码行数:10,代码来源:App.cs

示例10: Register

 public void Register(IPipelines pipelines)
 {
     pipelines.EnableBasicAuthentication(new BasicAuthenticationConfiguration(_authenticationService, "NzbDrone"));
     pipelines.BeforeRequest.AddItemToEndOfPipeline(RequiresAuthentication);
 }
开发者ID:Kiljoymccoy,项目名称:NzbDrone,代码行数:5,代码来源:EnableAuthInNancy.cs


注:本文中的IPipelines.EnableBasicAuthentication方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。