2015-11-12 5 views
5

WCFサービスを呼び出すASP.NETアプリケーションがあります。 ASP.NETアプリケーションでは、認証を実行するためにADFSを呼び出し、CurrentPrincipalでユーザーのすべてのクレームを確認できます。それから、私はWCFサービス(wsHttpBinding)の呼び出しを実行しますが、要求のリストは空です。WCF/WIF - バックエンドでクレームを見つける必要がありますか?

何故その理由が考えられますか?

+2

WS2007FederationHttpBinding? – nzpcmad

答えて

3

私はWCFでクレームを得るためにさまざまな方法を間違えていない場合。

スレッド:CurrentPrincipal - シンプルで使いやすいですが、あなたの設定では、ほとんど無視される設定が必要です。

<behaviors> 
    <serviceBehaviors> 
    <behavior name="Test.Services.WifBehavior"> 
     <serviceCredentials useIdentityConfiguration="true" /> 
     <!---Set principalPermissionMode to always to pass the ClaimsIdentity info to the Thread.CurrentPrincipal--> 
     <serviceAuthorization principalPermissionMode="Always"/> 
    </behavior> 
    <serviceBehaviors> 
</behaviors> 

OperationContext.Current.ClaimsPrincipal - これは、いくつかの設定が必要な場合、私は覚えていないことが、私はあなたが呼び出されたメソッドから直接それを得ることができますね。

OperationContext.ServiceSecurityContext.AuthorizationContext.ClaimSets - Create a Custom Authorization Manager for a Serviceを追加する必要があります。

私はWindows Identity Foundation(WIF)を使用しています。

関連する問題