Search code examples
c#wcfwcf-security

WCF expect header on every request


I'm not sure how simple this is but I am trying to achieve a WCF Restful Service but whenever a method is hit I want it "intercepted", This interception will check if header information exists identifying the user.

At the moment I am researching the best way to do this and have come across numerous mechanisms.

Search results before posting this comes up with "WCF REST Starter Kit" but my searching indicates this is abandoned!

Additionally, there is apparently something called a "RequestInterceptor" but not found a great deal on this either. I have come across the "ServiceAuthorizationManager" which I have had trouble with for a few days now (in the sense that it never gets called even though I set it the config)

<serviceAuthorization serviceAuthorizationManagerType="SomeNamespace.MyAuthorizationManager,SomeNamespace" />

I have my service operational and one way I have this validation working is via inheritance. Not a great approach but hoping for someone to suggest a better way.

No restriction on version of .NET as this is a personal exercise I am working on :)


Solution

  • If you want to inspect incoming request Messages, check Message Inspectors