How-to: Hawk authentication scheme with SignalR

On a recent machine-to-machine communication scenario I needed to enable secure push messages. The server side of the project was plain ASP.NET Web API 2 (on OWIN – I just love it) so dropping in SignalR and a few hubs was done in minutes. The tricky part was that I was using the Hawk authentication scheme to secure the access (and I was very happy on how it worked out so far). So no reason to change anything about the global setup if it wasn’t for the .NET SignalR client library not supporting Hawk out-of-the-box.

But luckily SignalR sources can be crawled through easily over at github (https://github.com/SignalR/SignalR). And even more luckily I found that it would be no more that a few lines to wire it up with Thinktecture’s Hawk implementation (Thinktecture.IdentityModel.Hawk on Nuget).

So there you go, my latest, greatest Nuget packages is: Pysco68.SignalR.HawkHandler.

Continue reading