如何将数据库凭据传递给 wcf 服务?
我们有一个连接到 Oracle 数据库的 WCF 服务。必须使用调用该服务的用户的凭据来完成与数据库的连接。
我如何设置它,以便我可以访问客户端的客户端凭据中设置的用户名和密码,以便我可以将这些添加到当我想要连接到数据库以获取数据时创建的连接字符串中服务电话?
或者还有其他方法可以处理这个问题吗?
如果有影响,我们将在 oracle 数据库中使用代理身份,因此所有用户都将作为主用户进行连接,并且代理身份将设置为传递的凭据,以确保查询在代理上下文中执行用户。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将您的服务设置为使用模拟。这样他们将采用服务客户端的身份。
设置完成后,您可以像这样获取调用者的 Windows 身份:
查看这篇博文,看看它是否对您有帮助。
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:
Check out this blog post and see if it helps you out.