12

我对这个疯了,在任何地方都找不到任何像样的信息..

有很多关于使用 WCF 和 Ntlm 模拟连接到 SharePoint 3.0 Web 服务的信息。但是,当访问 SharePoint 服务的客户端远离 SharePoint 网络并需要进行身份验证时,如何最好地配置凭据并将其传递给 SharePoint 服务。

我可以在 servicemodel.config 中的 SharePoint 框本地指定 Windows 用户名和密码吗?我们的 SharePoint 实例在访问它的域之外作为独立运行。因此,模拟是无关紧要的,因为共享点框上不存在域用户。

我尝试了许多组合,例如以下代码..但是我反复遇到异常,例如:

“HTTP 请求未经客户端身份验证方案‘匿名’未经授权。从服务器收到的身份验证标头是‘NTLM,Basic realm="wss.internaldev.local"’。

谁能提供一个使用 Windows 凭据连接到“远程”SharePoint Web 服务的示例?

ListsSoapClient proxy = new ListsSoapClient();

proxy.ClientCredentials.Windows.ClientCredential.UserName = "admin_user";
proxy.ClientCredentials.Windows.ClientCredential.Password = "admin_password";
proxy.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Identification;

listItems = proxy.GetListItems(...);

proxy.Close();

绑定示例:

<security mode="TransportCredentialOnly">
  <transport clientCredentialType="Windows" proxyCredentialType="None" />
</security>

或者..

<security mode="TransportCredentialOnly">
  <transport clientCredentialType="Ntlm" />
</security> 

行为:

<behavior name="behavior_WSS">
  <clientCredentials>
    <windows allowedImpersonationLevel="Impersonation" allowNtlm="true" />
  </clientCredentials>
</behavior>

或者

    <windows allowedImpersonationLevel="Delegation" allowNtlm="true" />
4

1 回答 1

1

你试过这里建议的东西吗?

例如,在代码中:

proxy.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonation.Impersonate;
// AllowNtlm = false;
于 2009-06-04T02:07:29.447 回答