1

サービス バスの STS として ACS を使用したいと考えています。Web サービスの認証に ACS を使用することができました。ただし、サービス バスにはトークンが必要ですが、ACS からトークンを取得する方法がわかりません。

要するに、acs (サービス バス -sb に対応するもの) にサービス ID として格納されている証明書と一致する証明書で認証することにより、クライアント wcf サービスがサービス バスを使用できるようにしたいと考えています。

また、サービス バスには NetTcpRelayBinding を使用しています。

クライアント証明書を使用してトークンを取得できれば、acs からトークンを使用できると思います...?

4

1 に答える 1

0

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 をバインド構成に組み込むと、同じメカニズムをシナリオに適用できるはずです。

于 2012-03-22T20:49:45.673 に答える