I've implemented a WCF service which is using WebServiceHost
and WebHttpBinding
. I'm manually performing Basic Authentication via a call like this at the beginning of each method call:
User u = GetAuthenticatedUser();
Where GetAuthenticatedUser
is using WebOperationContext.Current.IncomingRequest.Headers["Authorization"]
header to authenticate user against entries in a database.
The problem that I'm having is that I'm making a call to GetAuthenticatedUser
multiple times within a single service call because my methods don't pass around the User object.
Is there anything for WCF which represents a per service call "state" where information can be saved?