jgauffin / Griffin.WebServer

A web server built on top of Griffin.Framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HTTPS support.

PhonicUK opened this issue · comments

It'd be very nice to see HTTPS support like the old standalone webserver component had. Especially if it can be implemented using TLS. I'd be quite happy to throw some money at whoever can make this happen.

Here is how you do it in the Griffin.Framework branch:

 var listener = new HttpListener();
            listener.ChannelFactory = new SecureTcpChannelFactory(new ServerSideSslStreamBuilder(certificate));
            listener.ClientConnected += OnConnect;
            listener.MessageReceived = OnMessage;
            listener.BodyDecoder = new CompositeIMessageSerializer();
            listener.Start(IPAddress.Any, 8083);

Does this support client certificates too?

Sorry, wrong of me. Just set the UseClientCertificate to true in the ServerSideSslStreamBuilder

Great :)

What about performing authentication of the certificates provided by clients, is there an event handler to hook into? Or better yet, is there a sample that includes the use of client certificates?

Create MyServerSideSslStreamBuilder and override OnRemoteCertifiateValidation

Is the Griffin.Framework branch the same Griffin.Framework I can now see on NuGet?

It's the official branch now