2

メッセージセキュリティとWindows認証でwsHttpBindingを使用するWCFサービスがあります。

コンソールアプリケーションサービスクライアントはサービスを呼び出すことができ、ServiceSecurityContext.Current.WindowsIdentityとThread.CurrentPrincipal.Identityの両方が適切なユーザーを表していることがわかります。

予想通り、現在のプリンシパルはIClaimsIdentityです。

SharePoint Webを開こうとすると、問題が発生します。偽装されたIDをデータベースまたは共有ポイントサーバーに渡すことができないことを示すアクセス拒否エラーが表示されます。ただし、これはすべて同じマシンにあるため、ダブルホップ認証の問題は発生しないはずです。

これは、クレームアプリケーションでホストされているサービスに対してヘッドレス認証を行う正​​しい方法ではありませんか?

4

1 に答える 1

0

現在、クレーム対応のSharePoint2010サイトに展開されている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を見ると、それは正しいです。これは、現在実行中のユーザーとのClaimsIdentityです。その後、SPUserTokenを作成または利用しなくても、新しいSPSiteインスタンスを開くことができます。

注意すべき重要な点の1つは、WCFサービスに接続する前に自分のIDを偽装しないことです。これが実行している場合、SharePointサーバーがクレームプロバイダーとの信頼関係を確立していない限り、機能しない可能性があります。

于 2011-04-21T21:50:59.553 に答える