I'm currently implementing RESTful services via WCF Data Services (System.Data.Services). My RESTful service is hosted in a window service. There is no IIS involved.
The service is working fine except that it cannot connect to my sql database as it requires impersonation.
In a normal WCF service I'm able to impersonate by accessing the WindowsIdentity of ServiceSecurityContext. Unfortunately, the ServiceSecurityContext is null for WCF Data Services and I do not have httpContext since it is hosted in a window service.
My current workaround is to set a fixed credentials at my window service. While this is fine for development, it is not acceptable by production.
Is it possible to get the identity of the caller so that i can use the identity to get to sql server? and how?