私は現在、Webサービス(WS1)を呼び出すアプリケーションを持っています。これはWS2上でホストされているサーバーの情報を取得/設定するために別のWebサービス(WS2)を呼び出します。 WS2から直接WS2に呼び出すアプリケーションがあるかのように、WS1からWS2にユーザーの資格情報を渡すことができるようにしたいと思います。これを行う方法はありますか?あるWebサービスから別のWebサービスに資格情報を渡すには?
これは私が現在持っているものです。
アプリケーションコード:
BasicHttpBinding basicHttpBinding =
new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly);
basicHttpBinding.Security.Transport.ClientCredentialType =
HttpClientCredentialType.Windows;
basicHttpBinding.MaxReceivedMessageSize = 131072000;
AppMgr.AppMgrSoapClient appMgr =
new AppMgr.AppMgrSoapClient(
basicHttpBinding,
new EndpointAddress(@"http://SomeServer/Service.asmx"));
appMgr.ClientCredentials.Windows.AllowedImpersonationLevel =
TokenImpersonationLevel.Impersonation;
appMgr.ChannelFactory.Credentials.Windows.ClientCredential =
CredentialCache.DefaultNetworkCredentials;
appMgr.SomeWebMethodCall();
( 'SomeServer' オン)Webサービスの1コード
BasicHttpBinding basicHttpBinding =
new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly);
basicHttpBinding.Security.Transport.ClientCredentialType =
HttpClientCredentialType.Windows;
basicHttpBinding.MaxReceivedMessageSize = 131072000;
WS2Service.WS2ServiceSoapClient myServiceReference =
new WS2Service.WS2ServiceSoapClient(
basicHttpBinding,
new EndpointAddress(@"http://SomeOtherServer/AnotherService.asmx"));
myServiceReference.ClientCredentials.Windows.AllowedImpersonationLevel =
TokenImpersonationLevel.Impersonation;
myServiceReference.ChannelFactory.Credentials.Windows.ClientCredential =
CredentialCache.DefaultNetworkCredentials;
そのWebサービスでの最後の行コードを変更する必要がある、私はそれを知っている...しかし、私はそれを設定するか分からない... ClientCredentials.UserNameがありますが、私はこのレベルでパスワードを持っていません。
"C#.NET 3.0"のようなものをタイトルに追加するのではなく、タグを使用してください。 –
私はWCFのセキュリティについてよく分かりませんが、あなたの問題は 'AllowedImpersonationLevel'にあると思います。私は 'TokenImpersonationLevel.Delegation'で試してみるhttp://msdn.microsoft.com/en-us/library/system.security.principal.tokenimpersonationlevel.aspx –
私は委任を試みました、私はまだ始まったWebユーザーを取得していますWS2側のサービス: – Tizz