简体   繁体   中英

How to authenticate a user in sharepoint server side object model?

I am developing an application using sharepoint 2010 server side object model. 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. I know how to do it using ASP.NET web services exposed by sharepoint.

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.

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.

EDIT: Client side OM/web services authentication

SharePoint with regular Windows authentication - will use callers indentity. 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). Kerberos authentication can be used to solve "NTML one hop" behavior, but it is rarely possible due to policies.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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