internal static void ConfigureTransportProtectionAndAuthentication(this HttpTransportSecurity httpTransportSecurity, HttpsTransportBindingElement httpsTransportBindingElement)
        {
            Debug.Assert(httpTransportSecurity != null, "httpTransportSecurity cannot be null");
            Debug.Assert(httpsTransportBindingElement != null, "httpsTransportBindingElement cannot be null");

            httpTransportSecurity.ConfigureAuthentication(httpsTransportBindingElement);
            httpsTransportBindingElement.RequireClientCertificate = httpTransportSecurity.ClientCredentialType == HttpClientCredentialType.Certificate;
        }
        internal static void ConfigureTransportAuthentication(this HttpTransportSecurity httpTransportSecurity, HttpTransportBindingElement httpTransportBindingElement)
        {
            Debug.Assert(httpTransportSecurity != null, "httpTransportSecurity cannot be null");
            Debug.Assert(httpTransportBindingElement != null, "httpTransportBindingElement cannot be null");

            if (httpTransportSecurity.ClientCredentialType == HttpClientCredentialType.Certificate)
            {
                throw Error.InvalidOperation(SRResources.CertificateUnsupportedForHttpTransportCredentialOnly);
            }

            httpTransportSecurity.ConfigureAuthentication(httpTransportBindingElement);
        }
示例#3
0
        internal static void ConfigureTransportAuthentication(this HttpTransportSecurity httpTransportSecurity, HttpTransportBindingElement httpTransportBindingElement)
        {
            Fx.Assert(httpTransportSecurity != null, "httpTransportSecurity cannot be null");
            Fx.Assert(httpTransportBindingElement != null, "httpTransportBindingElement cannot be null");

            if (httpTransportSecurity.ClientCredentialType == HttpClientCredentialType.Certificate)
            {
                throw Fx.Exception.AsError(new InvalidOperationException(SR.CertificateUnsupportedForHttpTransportCredentialOnly));
            }

            httpTransportSecurity.ConfigureAuthentication(httpTransportBindingElement);
        }