使用WCF连接并验证SharePoint

时间:2009-06-02 04:44:38

标签: web-services sharepoint wss windows-authentication

我很难解决这个问题,无论如何都找不到任何合适的信息......

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

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

我尝试了许多组合,例如以下代码..但是我反复得到例外情况:

“HTTP请求未经授权,客户端身份验证方案为'Anonymous'。从服务器收到的身份验证标头为'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" />

1 个答案:

答案 0 :(得分:1)

您是否尝试过the things suggested here

例如,在代码中:

proxy.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonation.Impersonate;
// AllowNtlm = false;
相关问题