Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need examples of using with Nancy self and WCF host #2

Open
rentocika opened this issue Nov 21, 2013 · 1 comment
Open

Need examples of using with Nancy self and WCF host #2

rentocika opened this issue Nov 21, 2013 · 1 comment

Comments

@rentocika
Copy link

Hello!

Could you share examples of using this with Nancy self and WCF host?

Thank you!

@codefox42
Copy link

Self-hosting example:

using System;
using Nancy;
using Nancy.Authentication.Ntlm;
using Nancy.Hosting.Self;

namespace NancySelfHostingWithNtlm
{
    internal static class Program
    {
        private static void Main(string[] args)
        {
            using (var host =
                new NancyHost(
                    new HostConfiguration { RewriteLocalhost = false },
                    new Uri("http://localhost:9000")))
            {
                host.Start();
                Console.WriteLine("Press any key to quit.");
                Console.ReadKey();
            }
        }
    }

    public sealed class MyModule : NancyModule
    {
        public MyModule()
        {
            this.RequiresNtlmAuthentication();

            Get[""] = _ =>
            {
                return "Hello world";
            };
        }
    }
}

To access the current user, the pull request of @jmerriweather is required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants