How can I pass an authenticated user's identity through the Client-Object Model?
SP 2010, Client Object Model code is on an IIS server. I want to pass the already authenticated Windows user to SharePoint.
lblCredentials.Text = HttpContext.Current.User.Identity.Name;
//lblCredentials.Visible = true;
using (ClientContext context = new ClientContext("https://myserver.com"))
{
context.Credentials = CredentialCache.DefaultNetworkCredentials; // has no effect
context.Load(context.Web.CurrentUser);
context.ExecuteQuery();
lblProdUserName.Text = context.Web.CurrentUser.LoginName;
}
In the code above my HttpContext.Current.User.Identity.Name is the user name from the browser. While the context.Web.CurrentUser is the username that is running the IIS Website (e.g. the Application Pool).
How can I specify that my COM code uses the HttpContext.Current.User.Identity.Name user?
I know I could use context.Credentials = new NetworkCredential("user", "password", "domain");
However, this is a windows account and I don't have the users password.