获取指定用户的凭证
我写了一个Windows服务。该服务必须连接 SharePoint 服务并获取每个用户不同的数据。 sharePoint 服务根据调用服务之前设置的用户凭据返回数据。
如果服务可以在任何需要获取此凭据的帐户下运行,我如何通过用户名和用户域获取用户凭据?
I wrtitting a windows service. This service has to connect SharePoint service and get data different for each user. sharePoint service return data based on user credentials whitch are set before calling service.
How can I get user credentials by user name and user domain if the service can be run under any account that needs to get this credentials?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据您添加共享点服务的方式(Web 引用或服务引用),可以使用不同的方法来随请求发送凭据。
使用 Web 引用,您可以添加一个
NetworkCredentials
对象,其方式如下:如果它是带有
wsHttpBinding
的服务引用,则如下所示:那么您需要存储用户名/您为其检索内容的每个用户的密码。
如果这是一个直通服务,其中客户端访问您的服务并代表用户访问共享点,您必须设置 Kerberos 身份验证并允许模拟通过。也许你可以扩展你想要完成的事情。
Depending on how you add the sharepoint service (web reference or service reference) there are different methods to send credentials with the request.
With a web reference you would add a
NetworkCredentials
object along the lines of:if it´s a service reference with
wsHttpBinding
then something like this:Then you need to store the username/password for each user you are retrieving content for.
If this is a pass-thru service where the client accesses your service and it access sharepoint on the users behalf you have to set up Kerberos authentication and allow impersonation to pass thru. Maybe you could expand on what you are trying to accomplish.