This is in relation to this question
I am hosting this WCF service in a custom service host. IIS is not an option.
Is there a way to inject an HTTP ‘Authenticate’ header in the server stack (if it’s missing) early on in the request process – such that a default user can be passed into the authentication/authorization process that I have in place for anonymous requests?
I need the SERVER to inject this on the receiving end – before further WCF processing…
I’m pretty sure I can do this with a custom BindingElement, or by extending the WebHttpBinding, but any examples or guidance would be greatly appreciated. I can’t find any examples of early header manipulation (pre authentication) in WCF.
By implementing an IDispatchMessageInspector you can plug into the pipeline server side; and manipulate messages.
In the AfterReceiveRequest method you can add to Request.Headers quite happily.
Wrap it with a behaviour attribute and apply it to your service.