[英]How to authenticate a user in sharepoint server side object model?
I am developing an application using sharepoint 2010 server side object model. 我正在开发使用sharepoint 2010服务器端对象模型的应用程序。 Can anyone tell me how do I authenticate a user? 谁能告诉我如何验证用户身份? what are the different possible methods that I can use use to achieve this? 我可以使用哪些不同的方法来实现这一目标? The question may be dumb as I am really new to sharepoint and I m stuck with it. 这个问题可能是愚蠢的,因为我对Sharepoint真的很陌生,但我一直坚持下去。 I know how to do it using ASP.NET web services exposed by sharepoint. 我知道如何使用Sharepoint公开的ASP.NET Web服务来做到这一点。
You need to create SPSite for given user and than all SharePoint objects created from such SPSite (ie SPWeb, lists of SPWeb,...) will be opened as that user. 您需要为给定的用户创建SPSite,然后从该SPSite创建的所有SharePoint对象(即SPWeb,SPWeb列表...)将以该用户身份打开。
Please carefully review all code that does impersonation, especially as "system" account. 请仔细检查所有可模拟的代码,尤其是作为“系统”帐户的代码。
Make sure to finish all operations with objects from impersonated SPSite before disposing the SPSite/SPWeb objects. 在处置SPSite / SPWeb对象之前,请确保完成对来自模拟的SPSite的对象的所有操作。
EDIT: Client side OM/web services authentication 编辑:客户端OM / Web服务身份验证
SharePoint with regular Windows authentication - will use callers indentity. 具有常规Windows身份验证的SharePoint-将使用呼叫者身份。 Note that if called from another server user's identity will not flow to the SharePoint server, user must be signed in locally so credentials can be used on next server (to sign in locally on a server one needs to know user name + password in clear text). 请注意,如果从另一台服务器调用的用户身份将不会流到SharePoint服务器,则该用户必须在本地登录,以便凭据可以在下一台服务器上使用(要在服务器上本地登录,则需要知道明文的用户名和密码)。 Kerberos authentication can be used to solve "NTML one hop" behavior, but it is rarely possible due to policies. Kerberos身份验证可用于解决“ NTML一跳”行为,但是由于策略的缘故,这种情况很少发生。
I don't know how to handle other authentication configurations, but you said you know how to deal with authenticatio using web services - there is no difference if you are using webservices (work wiht SharePoint 2007 and 2010) or client side OM (2010) http://msdn.microsoft.com/en-us/library/ee535231.aspx . 我不知道如何处理其他身份验证配置,但是您说您知道如何使用Web服务处理身份验证-如果您使用的是Web服务(与SharePoint 2007和2010结合使用)或客户端OM(2010),则没有区别http://msdn.microsoft.com/zh-cn/library/ee535231.aspx 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.