|
13 | 13 | import java.util.Properties; |
14 | 14 | import java.util.Set; |
15 | 15 |
|
16 | | -import javax.net.ssl.SSLContext; |
17 | | - |
18 | 16 | import org.apache.commons.lang.StringUtils; |
19 | 17 | import org.apache.commons.lang.builder.EqualsBuilder; |
20 | 18 | import org.apache.commons.lang.builder.HashCodeBuilder; |
@@ -74,16 +72,16 @@ public class DefaultDockerClientConfig implements Serializable, DockerClientConf |
74 | 72 |
|
75 | 73 | private final String registryUsername, registryPassword, registryEmail, registryUrl, dockerConfig; |
76 | 74 |
|
77 | | - private final SSLContext sslContext; |
| 75 | + private final SSLConfig sslConfig; |
78 | 76 |
|
79 | 77 | private final RemoteApiVersion apiVersion; |
80 | 78 |
|
81 | 79 | DefaultDockerClientConfig(URI dockerHost, String dockerConfig, String apiVersion, String registryUrl, |
82 | | - String registryUsername, String registryPassword, String registryEmail, SSLContext sslContext) { |
| 80 | + String registryUsername, String registryPassword, String registryEmail, SSLConfig sslConfig) { |
83 | 81 | this.dockerHost = checkDockerHostScheme(dockerHost); |
84 | 82 | this.dockerConfig = dockerConfig; |
85 | 83 | this.apiVersion = RemoteApiVersion.parseConfigWithDefault(apiVersion); |
86 | | - this.sslContext = sslContext; |
| 84 | + this.sslConfig = sslConfig; |
87 | 85 | this.registryUsername = registryUsername; |
88 | 86 | this.registryPassword = registryPassword; |
89 | 87 | this.registryEmail = registryEmail; |
@@ -296,8 +294,8 @@ public AuthConfigurations getAuthConfigurations() { |
296 | 294 | } |
297 | 295 |
|
298 | 296 | @Override |
299 | | - public SSLContext getSSLContext() { |
300 | | - return sslContext; |
| 297 | + public SSLConfig getSSLConfig() { |
| 298 | + return sslConfig; |
301 | 299 | } |
302 | 300 |
|
303 | 301 | // CHECKSTYLE:OFF |
@@ -333,7 +331,7 @@ public static class Builder { |
333 | 331 |
|
334 | 332 | private boolean dockerTlsVerify; |
335 | 333 |
|
336 | | - private SSLContext customSslContext = null; |
| 334 | + private SSLConfig customSslConfig = null; |
337 | 335 |
|
338 | 336 | /** |
339 | 337 | * This will set all fields in the builder to those contained in the Properties object. The Properties object should contain the |
@@ -413,30 +411,30 @@ public final Builder withDockerTlsVerify(Boolean dockerTlsVerify) { |
413 | 411 | } |
414 | 412 |
|
415 | 413 | /** |
416 | | - * Overrides the default {@link SSLContext} that is used when calling {@link Builder#withDockerTlsVerify(true)} and |
417 | | - * {@link Builder#withDockerCertPath(String)}. This way it is possible to pass a custom {@link SSLContext} to the resulting |
| 414 | + * Overrides the default {@link SSLConfig} that is used when calling {@link Builder#withDockerTlsVerify(java.lang.Boolean)} and |
| 415 | + * {@link Builder#withDockerCertPath(String)}. This way it is possible to pass a custom {@link SSLConfig} to the resulting |
418 | 416 | * {@link DockerClientConfig} that may be created by other means than the local file system. |
419 | 417 | */ |
420 | | - public final Builder withCustomSslContext(SSLContext customSslContext) { |
421 | | - this.customSslContext = customSslContext; |
| 418 | + public final Builder withCustomSslConfig(SSLConfig customSslConfig) { |
| 419 | + this.customSslConfig = customSslConfig; |
422 | 420 | return this; |
423 | 421 | } |
424 | 422 |
|
425 | 423 | public DefaultDockerClientConfig build() { |
426 | 424 |
|
427 | | - SSLContext sslContext = null; |
| 425 | + SSLConfig sslConfig = null; |
428 | 426 |
|
429 | | - if (customSslContext == null) { |
| 427 | + if (customSslConfig == null) { |
430 | 428 | if (dockerTlsVerify) { |
431 | 429 | dockerCertPath = checkDockerCertPath(dockerCertPath); |
432 | | - sslContext = new LocalDirectorySSLConfig(dockerCertPath).getSSLContext(); |
| 430 | + sslConfig = new LocalDirectorySSLConfig(dockerCertPath); |
433 | 431 | } |
434 | 432 | } else { |
435 | | - sslContext = customSslContext; |
| 433 | + sslConfig = customSslConfig; |
436 | 434 | } |
437 | 435 |
|
438 | 436 | return new DefaultDockerClientConfig(dockerHost, dockerConfig, apiVersion, registryUrl, registryUsername, |
439 | | - registryPassword, registryEmail, sslContext); |
| 437 | + registryPassword, registryEmail, sslConfig); |
440 | 438 | } |
441 | 439 |
|
442 | 440 | private String checkDockerCertPath(String dockerCertPath) { |
|
0 commit comments