locked
Using HMAC-SHA256 Authentication for WCF with HttpModule RRS feed

  • Question

  • User1161013738 posted

    Hi,

    I'm trying to do HMAC-SHA256 authentication for my WCF webservices.

    After much reading about HMAC-SHA on the web, I started to apply them into my project.

    Now that I've successfully encrypt the message on the client-side, but how do I go about authenticating the request before the request entering the WebMethods?

    I suppose I should add a HttpModule to tap into the Init() event and do validation there?

    But as soon as I added the HttpModule to my WCF project and configure the web.config, I'm getting error saying:

    An error occurred while receiving the HTTP response to http://localhost:61884/MyService.svc. 
    This could be due to the service endpoint binding not using the HTTP protocol. 
    This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). 
    See server logs for more details.

    Am I right about using HttpModule in this context?

    Friday, September 6, 2013 4:16 AM

Answers

  • User1161013738 posted

    I figured that HttpModule doesn't work for self-hosted WCF service which launched from VisualStudio.

    After hosting the WCF service within IIS, HttpModule is hitting the breakpoint at BeginRequest() now.

    Hopefully this tip helps others in future.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 10, 2013 11:48 AM

All replies

  • User-488622176 posted

    Hi,

    I'm not familiar with this authentication method. Does this help you : http://msdn.microsoft.com/en-us/library/windowsazure/hh289317.aspx

    HTH

    Monday, September 9, 2013 7:52 AM
  • User-1662538993 posted

    Can you post your config file for service?

    Tuesday, September 10, 2013 10:39 AM
  • User1161013738 posted

    I figured that HttpModule doesn't work for self-hosted WCF service which launched from VisualStudio.

    After hosting the WCF service within IIS, HttpModule is hitting the breakpoint at BeginRequest() now.

    Hopefully this tip helps others in future.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 10, 2013 11:48 AM