I have a self-hosted SignalR
application using OWIN
.
I would like to add Windows Authentication to the incoming requests. Is this possible?
I believe that I can add e.g. Forms Authentication via something like this.
However I can't find any way to use Windows Authentication to do something similar.
My fallback plan would be to host in IIS instead, but I would prefer to be able to keep my app as a Windows Service if I can.
I was facing the same problem as you, and decided to implement a NTLM / Windows Authentication middleware;
You can find it on Nuget:
Sources and more detailed information on how-to use it are awailable here: https://github.com/pysco68/Pysco68.Owin.Authentication.Ntlm
The minimal usage example might look like:
Please note that for performance reasons I decided to stick with Cookie authentication in the end and to use NTLM just for the initial authentication round-trip (because of the high number of requests).
Ideally there'd be an NTLM owin middlware but since there is none you can work around it by getting a handle on the HttpListener and enabling auth that way (it's natively supported by HttpListener):