This project has moved and is read-only. For the latest updates, please go here.

AuthenticationMiddleware vs DelegatingHandler

May 13, 2014 at 11:20 PM
We need to implement client certificate authentication. For that we can create a new middleware deriving from AuthenticationMiddleware<TOptions>, and associate it using IAppBuilder.Use(...) at startup (we also need to decorate APIs in Controllers with [Authorize] attribute). Or we can just define a DelegatingHandler, and associate it using HttpConfiguration.MessageHandlers.Insert(...). which option is preferable (let assume all APIs need authentication)?
May 13, 2014 at 11:26 PM
If you just need it for WebApi then either solution will work. If you also need it for other parts of your app then you'll need to build it at as an auth middleware. Most other considerations deal with your familiarity with the programing model of each.
Marked as answer by Tratcher on 5/21/2014 at 2:08 PM
May 13, 2014 at 11:39 PM
thank you. we mainly need it for Web API. what other parts are you referring to?
May 13, 2014 at 11:44 PM
SignalR, Nancy, etc..
May 13, 2014 at 11:53 PM
oh ok. thanks.