C#クライアントアプリケーションで使用されているWCF Webサービスがあります。また、Active Directoryに4つのグループが保存されています。クライアントアプリケーションは、このWebサービスに接続するためにユーザーの資格情報を渡しています。ユーザーグループに基づいてWCF Webサービス機能を制限する
次のようにクライアントアプリケーションによってアクセスされるように、複数のAPIやメソッドを公開するWebサービス:
[OperationContract]
bool Read();
[OperationContract]
bool Write();
読む()メソッドにアクセスするすべてのクライアントのための
write()メソッドによってのみアクセス可能であるべきでなければなりませんユーザーは、Active Directoryによって管理される特定のWindowsユーザーグループに属します。
質問:公開されたインターフェイスまたはメソッドを、広告のユーザーグループ管理に基づいてクライアントによってフィルタリングまたは制限するにはどうすればよいですか?
jrista、ご返信用 感謝。 PrincipalPermissionと同じディレクティブを次のように試しました。
[PrincipalPermission(SecurityAction.Demand, Role = "Readers")]
[OperationContract]
bool Read();
[PrincipalPermission(SecurityAction.Demand, Role = "Writers")]
[OperationContract]
bool Write();
しかし、動作しません。 ReadグループユーザーはWriter()メソッドも呼び出すことができ、WriterグループユーザーはWrite()メソッドも呼び出すことができます。
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBind">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" proxyCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="DXDirectory.DXDirectoryService" behaviorConfiguration="DXDirectory.Service1Behavior">
<!-- Service Endpoints -->
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBind"
name="BasicBinding" contract="DXDirectory.IDXDirectoryService">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="DXDirectory.Service1Behavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceAuthorization principalPermissionMode="UseWindowsGroups"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
が、それはこの機能のためにwsHttpBindingを実装している必要があります私はあなたに伝えたい
ことの一つは、次のように私は私のweb.configファイルでBasicHttpBindを使用しているということでしょうか?はいの場合、WebサービスでwsHttpBindingを実装するにはどうすればよいですか?
WCFが何らかの理由で契約インタフェースの宣言型セキュリティを認識しないため、実際の実装が必要であることがわかりました。 –