0

I have 2 sharepoint sites running out of one sharepoint installation. One site has claims based enabled and the other has classic auth enabled. Both sites also both use Kerberos.

I am using ManifoldCF to connect to these sites to extract the all content as well as the permissions. The ManifoldCF connector connects to the site with classic auth enabled and works as expected. However, trying to crawl the claims based site generates a 401 unauthorised error.

There is a web service package supplied with ManifoldCF that is accessed called MCPermissions.asmx. This file contains the following block of code which sets the user's credentials:

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);
}

This code is accessed via ManifoldCF correctly, but it seems its the request made in the plugin to /_vti_bin/Permissions.asmx that is causing the 401 issue.

I have tried setting pre defined credentials in the code above using NetworkCredential ("username", "password", "domain") but no luck.

Example:

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;

With the claims based authentication, the username that i enter into ManfoldCF or in the browser authentication gets changed from the regular \ format to the claims username format (e.g. i:0#.w||/).

Does anybody know why claims based would be causing the 401 issue where the classic authentication does not?

4

1 回答 1

0

原来这是 ManifoldCF 1.2 版本的一个错误。它已在较新的版本中得到修复。

于 2014-05-06T23:56:56.823 回答