Пример #1
0
        protected override void RequestStartup(TinyIoCContainer requestContainer, IPipelines pipelines, NancyContext context)
        {
            //Console.WriteLine(context.Request.Url.ToString());
            base.RequestStartup(requestContainer, pipelines, context);

            // At request startup we modify the request pipelines to
            // include forms authentication - passing in our now request
            // scoped user name mapper.
            //
            // The pipelines passed in here are specific to this request,
            // so we can add/remove/update items in them as we please.

            var formsAuthConfiguration = new Nancy.Authentication.Forms.FormsAuthenticationConfiguration()
            {
                RedirectUrl = "~/login",
                CryptographyConfiguration = this._cryptographyConfiguration,
                UserMapper = requestContainer.Resolve <Nancy.Authentication.Forms.IUserMapper>(),
            };

            Nancy.Authentication.Forms.FormsAuthentication.Enable(pipelines, formsAuthConfiguration);
        }
Пример #2
0
        protected override void RequestStartup(TinyIoCContainer requestContainer, IPipelines pipelines, NancyContext context)
        {
            //Console.WriteLine(context.Request.Url.ToString());
            base.RequestStartup(requestContainer, pipelines, context);

            // At request startup we modify the request pipelines to
            // include forms authentication - passing in our now request
            // scoped user name mapper.
            //
            // The pipelines passed in here are specific to this request,
            // so we can add/remove/update items in them as we please.

            var formsAuthConfiguration = new Nancy.Authentication.Forms.FormsAuthenticationConfiguration()
            {
                RedirectUrl = "~/login",
                CryptographyConfiguration= this._cryptographyConfiguration,
                UserMapper = requestContainer.Resolve<Nancy.Authentication.Forms.IUserMapper>(),
            };

            Nancy.Authentication.Forms.FormsAuthentication.Enable(pipelines, formsAuthConfiguration);
        }