Reputation: 32936
We have a WCF service that connects to an oracle database. The connection to the database must be done using the credentials of the user that is calling the service.
How can I set it up so that I can get access to the username and password set in the client credentials at the client so that I can add these to the connections string created when I want to connect to the database to get the data for the service call?
Or is there some other way that this should be handled?
If it makes a difference we will be using proxy identity in the oracle database, so all users will connect as a main user and the proxy identity will be set to be the passed credentials to ensure that the queries are executed in the context of the proxy user.
Upvotes: 2
Views: 1641
Reputation: 8152
Setup your service(s) to use Impersonation. This way they will take on the identity of the service client.
Once this is setup, you can get the caller's Windows Identity like this:
WindowsIdentity callerWindowsIdentity = ServiceSecurityContext.Current.WindowsIdentity;
Check out this blog post and see if it helps you out.
Upvotes: 2