WCFでクライアント証明書の資格情報を使用してACSからトークンを取得することは、十分にサポートされています。
WCFクライアント証明書認証が利用可能なACSサンプルがあります。here、Acs2CertificateBindingSampleを探します。
public static Binding CreateServiceBinding(string acsCertificateEndpoint)
{
return new IssuedTokenWSTrustBinding(CreateAcsCertificateBinding(), new EndpointAddress(acsCertificateEndpoint));
}
public static Binding CreateAcsCertificateBinding()
{
return new CertificateWSTrustBinding(SecurityMode.TransportWithMessageCredential);
}
そして、どのようにこのバインディングを使用してチャネルファクトリを作成するには、どのようにあなたのクライアント証明書の資格情報を指定するには::
ChannelFactory<IStringService> stringServiceFactory = new ChannelFactory<IStringService>(Bindings.CreateServiceBinding(acsCertificateEndpoint), serviceEndpointAddress);
// Set the service credentials and disable certificate validation to work with sample certificates
stringServiceFactory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
stringServiceFactory.Credentials.ServiceCertificate.DefaultCertificate = GetServiceCertificate();
// Set the client credentials.
stringServiceFactory.Credentials.ClientCertificate.Certificate = GetClientCertificateWithPrivateKey();
関心のポイントは、それはACSからトークンを取得し、結合を作成する方法ですサンプルはサービスバスを使用せず、シンプルな "IStringService"インターフェイスだけですが、NetTcpRelayBindingをバインディングコンポジションに組み込む場合、同じメカニズムをシナリオに適用する必要があります。