匿名アクセスが無効で、Windows認証が有効な統合モードの既定のアプリケーションプールでIIS 7でホストされているWCFサービスがあります。WCF:NetworkCredentialと偽装の関係
私のインターフェイスのメソッド実装に次の属性を追加しました。
[OperationBehavior(Impersonation = ImpersonationOption.Required)]
私は私のサービスの呼び出しでネットワーク資格情報を指定しない場合、私は、次の点で期待される動作を取得するには、真である:
ServiceSecurityContext.Current.WindowsIdentity.Name = MYDOMAIN \ myuserの
ServiceSecurityContext .Current.PrimaryIdentity.Name = myDomain \ myUser
Thread.CurrentPrincipal.Identity.Name = myDomain \ myUser
SSPIとmyDomain \ myUser認証を使用して、リモートシステムのデータベースに接続できます。
WindowsIdentity.GetCurrent()。Name = myDomain \ myUser
私はThread.CurrentPrincipal.IsInRole()を使用して、ユーザーが役割にいることを確認できます。
WindowsIdentity.GetCurrent()。Groupsを使用して、ユーザーのグループの一覧を取得できます。
しかし、私は、次を使用して、ネットワーク信用証明書を供給場合:
var networkCredential = new NetworkCredential(user, pwd, dom);
base.ClientCredentials.Windows.ClientCredential = networkCredential;
base.ClientCredentials.Windows.AllowNtlm = true;
base.ClientCredentials.Windows.AllowedImpersonationLevel
= System.Security.Principal.TokenImpersonationLevel.Delegation;
を次に上記の全ては、データベース接続、列挙された基を2つ除いて同じであるが異なっています。データベースへの接続は、NT Authority \ Anonymousログインユーザーを使用して行われています。 NetworkCredentialsを使用すると、NT Authority \ InteractiveではなくNT Authority \ Networkグループにユーザーが置かれ、さらにLOCALグループが削除されます。
私の目標は、NetworkCredentialによって渡された資格情報を使用してデータベースに接続することです。ご了承ください。
シェーンホルダー
私は()。AuthenticationType WindowsIdentity.GetCurrentを検討を加え、それは両方のシナリオにケルベロスあります。 また、資格情報を送信するときに、委任できると想定して、AllowedImpersonationLevelを委任に設定しています。 – ShaneH
Thread.CurrentPrincipal.IdentityをWindowsIdentityにキャストし、サーバー上のImpersonationLevelを確認します。 –
どちらの場合でもImpersonationLevelは偽装です。 – ShaneH