简体   繁体   English

通过客户端服务器框架将Windows身份传递给SQL Server

[英]Pass Windows Identity through Client Server framework to SQL Server

I have a corporate client server application. 我有一个企业客户端服务器应用程序。 It passes majority of the work from the client application (Windows 7) to the server application (Server 2008 R2), and when it comes to running a SQL query (SQL Server 2008), it is handled by the server - which registers the user as the server. 它将大部分工作从客户端应用程序(Windows 7)传递到服务器应用程序(Server 2008 R2),并且在运行SQL查询(SQL Server 2008)时,由服务器处理-注册用户作为服务器。

We then have a table in our database which is locked down using Active Directory. 然后,我们的数据库中就有一个表已使用Active Directory锁定。 Our client and server are written in .Net 4.0. 我们的客户端和服务器是用.Net 4.0编写的。 I'm Using WCF (net.tcp). 我正在使用WCF(net.tcp)。

How would I pass the logged in user security token from our Windows 7 client, to our server in order for the server to turn around and use it to connect to the SQL server to run a couple of quick queries. 我如何将登录的用户安全令牌从Windows 7客户端传递到服务器,以便服务器转身并使用它连接到SQL Server来运行几个快速查询。

Any thoughts, or ideas, would be greatly appreciated! 任何想法或想法,将不胜感激! Thanks. 谢谢。

You might want to create a service account for SQL server access. 您可能要创建一个用于SQL Server访问的服务帐户。

You can impersonate/change identity in your windows application using the service account before making a call to database. 可以在调用数据库之前使用服务帐户在Windows应用程序中模拟/更改身份。 so while database call is being executed it will run under impersonated identity(service account). 因此,在执行数据库调用时,它将以模拟身份(服务帐户)运行。 For impersonation in windows application see this MSDN Article 有关Windows应用程序中的模拟, 请参阅此MSDN文章

What you are talking about is the double hop scenario. 您所说的是双跳方案。 Check out this SO question regarding how to set up double hop possibilities. 看看这个关于如何设置双跳可能性SO问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM