Ok, so I have a WebAPI authentication service that is used to request / token and returns a Bearer token to the client, I added AppId and Api Key to the properties so that I return
{ "access_token": "...", "token_type": "bearer", "expires_in": 86399, "dm:appid": "1", "dm:apikey": "...", ".issued": "Wed, 01 Jul 2015 20:46:45 GMT", ".expires": "Thu, 02 Jul 2015 20:46:45 GMT" }
The AppId and Api keys must be used by the client to generate an Hmac SHA256 signature for each request.
On my controller, I used the Authorize attribute and created an HmacAuthentication attribute that implements IAuthenticationFilter
[RoutePrefix("api/account")] [Authorize] [HmacAuthentication] public class AccountController : ApiController {
The problem is that any request to this controller expects the Authorization: Bearer ... header and the HmacAuthentication attribute also expects the Authorization: amx .
Now I know that you can have only one authorization header, so my quandry is how I can implement both authorization headers without breaking HTTP, someone has achieved using OWIN OAuth and HMAC Authentication
I followed these examples from Taiseer Joudeh
Token Based Authentication Using ASP.NET Web API 2, Owin, and Identity ASP.NET Secure Web API Using API Key Authentication - HMAC Authentication
source share