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

            string realm = "PickAPizzaApi";
            var userValidator = container.Resolve<IUserValidator>();

            pipelines.BeforeRequest += this.CheckCache;

            pipelines.AfterRequest += this.SetCache;

            pipelines.EnableBasicAuthentication(new BasicAuthenticationConfiguration(userValidator, realm));
        }
Ejemplo n.º 2
0
        protected override void ApplicationStartup(TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines)
        {
            base.ApplicationStartup(container, pipelines);

            container.Register(
                new ScanSettings
                {
                    CommunityString = ConfigurationManager.AppSettings["snmpCommunityString"]
                });

            container.Register<IUserValidator>(
                new UserValidator(
                    ConfigurationManager.AppSettings["user"],
                    ConfigurationManager.AppSettings["password"]));

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