クレームウェアWCFサービスに接続するSilverlight4アプリケーションに取り組んでいます。次のコードを使用して、WCFでクレームトークンを取得し、承認を実行しています。
IClaimsPrincipal principal = ( IClaimsPrincipal )Thread.CurrentPrincipal;
IClaimsIdentity identity = ( IClaimsIdentity )principal.Identity;
return string.Format( "You entered: {0} and you are {1}", value, identity.Name );
WCFでwsHttpBindingを使用し、コンソールアプリで試してみると、正常に機能します。ただし、SilverlightはbasicHttpとcustomeBindingのみをサポートしているため、wsHttp、ws2007Http、またはその他のバインディングを使用することはできません。そのため、SilverlightからWCFのIClaimIdentityトークンを取得していません。
Silverlightでサポートされているバインディングのいずれかを使用しても、WCFでClaimIdentityを取得する方法はありますか?これについてもっと読むことができるチュートリアル/ヘルプテキストはありますか?
私のWCF設定は次のとおりです。
<system.serviceModel>
<services>
<service name="ClainAwareWCF.Service" behaviorConfiguration="ClainAwareWCF.ServiceBehavior">
<endpoint address="" binding="basicHttpBinding" contract="ClainAwareWCF.IService" bindingConfiguration="basicbind">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="basicbind">
<security mode="TransportCredentialOnly"></security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="ClainAwareWCF.ServiceBehavior" >
<federatedServiceHostConfiguration/>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<extensions>
<behaviorExtensions>
<add name="federatedServiceHostConfiguration" type="Microsoft.IdentityModel.Configuration.ConfigureServiceHostBehaviorExtensionElement, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</behaviorExtensions>
</extensions>
</system.serviceModel>