Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/154.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SharePoint 2010中托管的WCF服务中的模拟_Wcf_Sharepoint_Sharepoint 2010_Wif_Claims - Fatal编程技术网

SharePoint 2010中托管的WCF服务中的模拟

SharePoint 2010中托管的WCF服务中的模拟,wcf,sharepoint,sharepoint-2010,wif,claims,Wcf,Sharepoint,Sharepoint 2010,Wif,Claims,我有一个WCF服务,它使用带有消息安全性和windows身份验证的wsHttpBinding 控制台应用程序服务客户端可以调用该服务,我可以看到ServiceSecurityContext.Current.WindowsIdentity和Thread.CurrentPrincipal.Identity都代表了正确的用户 正如预期的那样,currentprincipal是IClaimIdentity 当我尝试打开SharePoint网站时会出现问题:我收到一个拒绝访问错误,提示无法将模拟身份传递到

我有一个WCF服务,它使用带有消息安全性和windows身份验证的wsHttpBinding

控制台应用程序服务客户端可以调用该服务,我可以看到ServiceSecurityContext.Current.WindowsIdentity和Thread.CurrentPrincipal.Identity都代表了正确的用户

正如预期的那样,currentprincipal是IClaimIdentity

当我尝试打开SharePoint网站时会出现问题:我收到一个拒绝访问错误,提示无法将模拟身份传递到数据库或SharePoint服务器。不过,这都是在同一台机器中进行的,因此不应该存在任何双跳身份验证问题


这不是针对索赔应用程序中托管的服务进行无头身份验证的正确方法吗?

我目前有WCF服务部署在支持索赔的SharePoint 2010网站中。WCF服务一点也不新奇,我使用提供的Microsoft.SharePoint.Client.services.MultipleBaseAddressBasicHttpBindingServiceHostFactory作为WCF服务工厂。因此,我使用的是通过工厂提供的开箱即用的BasicHttpBinding

我的客户端app.config如下所示:

<configuration>
  <system.serviceModel>
    <bindings>
      <binding name="BasicHttpBinding_MyServices" closeTimeout="00:01:00"
        openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
        allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
        maxBufferSize="200524288" maxBufferPoolSize="200524288" maxReceivedMessageSize="200524288"
        messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
        useDefaultWebProxy="true">
        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
          maxBytesPerRead="4096" maxNameTableCharCount="16384" />
        <security mode="TransportCredentialOnly">
          <transport clientCredentialType="Ntlm" proxyCredentialType="None" realm="" />
          <message clientCredentialType="UserName" algorithmSuite="Default" />
        </security>
      </binding>
    </bindings>
    <client>
      <endpoint address="http://localhost/_vti_bin/MyServices/MyService.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_MyServices"
        contract="ServiceClient.MyService.IMyService"
        name="BasicHttpBinding_IMyService" />
    </client>
  </system.serviceModel>
</configuration>

当查看我的Thread.CurrentPrincipal.Identity时,它是正确的。这是与我当前正在执行的用户之间的权利冲突。然后,我可以简单地打开一个新的SPSite实例,而无需创建或使用SPUserToken


需要注意的一点是:在连接到WCF服务之前,我不会模拟我的身份。如果这就是您正在做的,那么除非您的SharePoint服务器与您的索赔提供商建立了信任关系,否则它不太可能工作

我目前在支持索赔的SharePoint 2010网站中部署了WCF服务。WCF服务一点也不新奇,我使用提供的Microsoft.SharePoint.Client.services.MultipleBaseAddressBasicHttpBindingServiceHostFactory作为WCF服务工厂。因此,我使用的是通过工厂提供的开箱即用的BasicHttpBinding

我的客户端app.config如下所示:

<configuration>
  <system.serviceModel>
    <bindings>
      <binding name="BasicHttpBinding_MyServices" closeTimeout="00:01:00"
        openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
        allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
        maxBufferSize="200524288" maxBufferPoolSize="200524288" maxReceivedMessageSize="200524288"
        messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
        useDefaultWebProxy="true">
        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
          maxBytesPerRead="4096" maxNameTableCharCount="16384" />
        <security mode="TransportCredentialOnly">
          <transport clientCredentialType="Ntlm" proxyCredentialType="None" realm="" />
          <message clientCredentialType="UserName" algorithmSuite="Default" />
        </security>
      </binding>
    </bindings>
    <client>
      <endpoint address="http://localhost/_vti_bin/MyServices/MyService.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_MyServices"
        contract="ServiceClient.MyService.IMyService"
        name="BasicHttpBinding_IMyService" />
    </client>
  </system.serviceModel>
</configuration>

当查看我的Thread.CurrentPrincipal.Identity时,它是正确的。这是与我当前正在执行的用户之间的权利冲突。然后,我可以简单地打开一个新的SPSite实例,而无需创建或使用SPUserToken


需要注意的一点是:在连接到WCF服务之前,我不会模拟我的身份。如果这就是您正在做的,那么除非您的SharePoint服务器与您的索赔提供商建立了信任关系,否则它不太可能工作

如何打开SP Web?您是否使用接受SPUserToken的构造函数重载?我也尝试过。我的IClaimIdentity似乎是Microsoft.IdentityModel.WindowsClaimsEntity,而不是Microsoft.IdentityModel.ClaimsEntity。如果IClaimsIdentity对象不是ClaimsIdentity,SharePoint的SPUserToken构造函数将引发异常。我想您需要转换声明。你试过从WindowsClaimsEntity实例化ClaimsEntity吗?是的,那不起作用。我还尝试从端点配置中删除联合扩展,并对服务使用普通windows身份验证。这使我回到了权限被拒绝错误。如果将windowsidentity作为输入,尝试从ClaimsEntity实例化spusertoken也会失败。如果您只考虑普通windows身份验证,是否在WCF端()配置了模拟?如何打开SP Web?您是否使用接受SPUserToken的构造函数重载?我也尝试过。我的IClaimIdentity似乎是Microsoft.IdentityModel.WindowsClaimsEntity,而不是Microsoft.IdentityModel.ClaimsEntity。如果IClaimsIdentity对象不是ClaimsIdentity,SharePoint的SPUserToken构造函数将引发异常。我想您需要转换声明。你试过从WindowsClaimsEntity实例化ClaimsEntity吗?是的,那不起作用。我还尝试从端点配置中删除联合扩展,并对服务使用普通windows身份验证。这使我回到了权限被拒绝错误。如果将windowsidentity作为输入,尝试从ClaimsEntity实例化spusertoken也会失败。如果您只考虑普通windows身份验证,是否在WCF端()配置了模拟?