I'm using SharePoint 2010 as a document store for a front-end .NET application. The SharePoint farm is using Claims Based Authentication. I want to call a WCF web service on the farm with a particular user's credentials.
We were doing this using Windows authentication, whereby the user logged in to the .NET app which authenticated against Active Directory, and we made the WCF calls using that identity. However now the .NET app is using WIF I don't know how to send the user's claims with the WCF call.
Here's the code we're using for the WCF call with Windows Auth:
SortedList groups = new SortedList();
SharepointUserGroupsWCF.UserGroupSoapClient client = new SharepointUserGroupsWCF.UserGroupSoapClient();
client.ClientCredentials.Windows.ClientCredential = (NetworkCredential)credentials;
client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
client.Endpoint.Address = new EndpointAddress(webPath + "/_vti_bin/usergroup.asmx");
XElement groupXml;
groupXml = client.GetGroupCollectionFromSite();
XmlDocument doc = new XmlDocument();
doc.LoadXml(groupXml.ToString());
XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
nsmgr.AddNamespace("sp", "http://schemas.microsoft.com/sharepoint/soap/directory/");
foreach (XmlNode group in doc.SelectNodes("//sp:Groups/sp:Group", nsmgr))
{
groups.Add(group.Attributes["Name"].Value.ToUpper(), "");
}
Where:
- webPath = https://sp.test.com/
- credentials = new NetworkCredential("MyUsername", "MyPassword", "MyDomain");
What I need help with is how to convert this to send claims instead of Windows credentials.