WCF 経由でクライアント証明書の資格情報を使用して ACS からトークンを取得することは、十分にサポートされているシナリオです。
WCF クライアント証明書の認証を行う ACS サンプルがここで入手できます。Acs2CertificateBindingSample を探してください。興味深い点は、ACS からトークンを取得するバインディングを作成する方法です。
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();
このサンプルではサービス バスを使用せず、単純な "IStringService" インターフェイスのみを使用していますが、NetTcpRelayBinding をバインド構成に組み込むと、同じメカニズムをシナリオに適用できるはずです。