本文整理汇总了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;
}
示例2: ApplicationStartup
protected override void ApplicationStartup(TinyIoC.TinyIoCContainer container, IPipelines pipelines)
{
base.ApplicationStartup(container, pipelines);
pipelines.EnableBasicAuthentication(new BasicAuthenticationConfiguration(
container.Resolve<IUserValidator>(),
"NancyFx"));
}
示例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;
};
}
示例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);
}
示例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());
}
示例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);
}
示例7: ApplicationStartup
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
{
base.ApplicationStartup(container, pipelines);
pipelines.EnableBasicAuthentication(new BasicAuthenticationConfiguration(new UserValidator(), "Nusharp", UserPromptBehaviour.Always));
}
示例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"));
}
示例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);
}
示例10: Register
public void Register(IPipelines pipelines)
{
pipelines.EnableBasicAuthentication(new BasicAuthenticationConfiguration(_authenticationService, "NzbDrone"));
pipelines.BeforeRequest.AddItemToEndOfPipeline(RequiresAuthentication);
}