我有2个SharePoint站点耗尽一个SharePoint安装。一个网站启用了声明,另一个启用了经典认证。这两个站点也都使用Kerberos。基于Sharepoint声明与经典身份验证
我正在使用ManifoldCF连接到这些网站以提取所有内容以及权限。 ManifoldCF连接器使用经典认证连接到站点,并按预期工作。但是,尝试抓取基于声明的网站会生成401未经授权的错误。
有一个与ManifoldCF一起提供的Web服务程序包,可以访问它,名为MCPermissions.asmx。此文件包含下面的代码块,设置用户的凭据:
try
{
// Only handle requests for "item". Send all other requests to the SharePoint web service.
if (objectType.Equals(itemType))
{
retVal = GetItemPermissions(objectName);
}
else
{
ServicePointManager.ServerCertificateValidationCallback +=
new RemoteCertificateValidationCallback(ValidateCertificate);
using (SPPermissionsService.Permissions service = new SPPermissionsService.Permissions())
{
service.Url = SPContext.Current.Web.Url + "/_vti_bin/Permissions.asmx";
service.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
retVal = service.GetPermissionCollection(objectName, objectType);
}
}
}
catch (SoapException soapEx)
{
throw soapEx;
}
catch (Exception ex)
{
SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory("MCPermissions.asmx", TraceSeverity.Unexpected, EventSeverity.Error), TraceSeverity.Unexpected, "Error: "+ex.Message+"; SPContext.Current.Web.Url='"+SPContext.Current.Web.Url+"'", ex.StackTrace);
throw RaiseException(ex.Message, "1000", ex.Source);
}
此代码是通过ManifoldCF正确访问,但似乎它在插件作出/_vti_bin/Permissions.asmx的要求,即是造成401问题。
我曾尝试使用NetworkCredential (“username”,“password”,“domain”)设置上面代码中的预定义凭据,但没有运气。
实施例:
string webUrl = SPContext.Current.Web.Url;
NetworkCredential myCredentials = new NetworkCredential("DOMAIN\\user", "mypassword", "DOMAIN");
CredentialCache credCache = new CredentialCache();
credCache.Add(new Uri(webUrl), "Negotiate", myCredentials);
service.Url = webUrl + "/_vti_bin/Permissions.asmx";
service.Credentials = credCache;
利用基于认证权利要求中,用户名,我进入ManfoldCF或在浏览器中的认证被从常规\格式权利要求用户名格式改变(例如I:0#。瓦特|| /)。
有没有人知道为什么索赔会导致经典认证没有的401问题?