Skip to content

Latest commit

 

History

History
44 lines (31 loc) · 1.48 KB

File metadata and controls

44 lines (31 loc) · 1.48 KB

← Timeout | HTTPS Configurations(中文) | Proxy Configurations →


HTTPS Configurations

Priority: Client > Default

  1. Ignore certificate

This must be set when the project first creates the client. Otherwise you need to close the last client with the command ApacheHttpClient.getInstance().close().

// Client HTTPS configurations
HttpClientConfig clientConfig = HttpClientConfig.getDefault();
// Configure not to verify the server certificates
clientConfig.setIgnoreSSLCerts(true);

IClientProfile profile = DefaultProfile.getProfile(regionId, accesskeyId, accesskeySecret);
profile.setHttpClientConfig(clientConfig);
DefaultAcsClient client = new DefaultAcsClient(profile);
 
  1. Customize the configuration of certificate validation

KeyManager and X509TrustManager are the interface. User implementation is required.

// Client HTTPS configurations
HttpClientConfig clientConfig = HttpClientConfig.getDefault();
// Configure user-defined TrustManagers
clientConfig.setX509TrustManagers(clientTrustManagers);
// Configure user-defined KeyManagers
clientConfig.setKeyManagers(clientKeyManagers);

IClientProfile profile = DefaultProfile.getProfile(regionId, accesskeyId, accesskeySecret);
profile.setHttpClientConfig(clientConfig);
DefaultAcsClient client = new DefaultAcsClient(profile);
 

← Timeout | HTTPS Configurations(中文) | Proxy Configurations →