private void AddServerCertMappingOrSetRemoteCertificateValidationCallback(HttpClientHandler httpClientHandler, EndpointAddress to) { Fx.Assert(httpClientHandler != null, "httpClientHandler should not be null."); if (_sslCertificateValidator != null) { httpClientHandler.ServerCertificateCustomValidationCallback = _remoteCertificateValidationCallback; } else { if (to.Identity is X509CertificateEndpointIdentity) { HttpTransportSecurityHelpers.SetServerCertificateValidationCallback(httpClientHandler); } } }
private void AddServerCertMappingOrSetRemoteCertificateValidationCallback(ServiceModelHttpMessageHandler messageHandler, EndpointAddress to) { Fx.Assert(messageHandler != null, "httpMessageHandler should not be null."); if (_sslCertificateValidator != null) { if (!messageHandler.SupportsClientCertificates) { throw ExceptionHelper.PlatformNotSupported("Client certificates not supported yet"); } messageHandler.ServerCertificateValidationCallback = _remoteCertificateValidationCallback; } else { HttpTransportSecurityHelpers.SetServerCertificateValidationCallback(messageHandler); } }