@@ -38,11 +38,13 @@ public final class S3CrtHttpConfiguration implements ToCopyableBuilder<S3CrtHttp
38
38
private final Duration connectionTimeout ;
39
39
private final S3CrtProxyConfiguration proxyConfiguration ;
40
40
private final S3CrtConnectionHealthConfiguration healthConfiguration ;
41
+ private final Boolean shouldTrustAllCertificates ;
41
42
42
43
private S3CrtHttpConfiguration (DefaultBuilder builder ) {
43
44
this .connectionTimeout = builder .connectionTimeout ;
44
45
this .proxyConfiguration = builder .proxyConfiguration ;
45
46
this .healthConfiguration = builder .healthConfiguration ;
47
+ this .shouldTrustAllCertificates = builder .shouldTrustAllCertificates ;
46
48
}
47
49
48
50
/**
@@ -73,6 +75,13 @@ public S3CrtConnectionHealthConfiguration healthConfiguration() {
73
75
return healthConfiguration ;
74
76
}
75
77
78
+ /**
79
+ * Return the configured {@link Builder#shouldTrustAllCertificates}.
80
+ */
81
+ public Boolean shouldTrustAllCertificates () {
82
+ return shouldTrustAllCertificates ;
83
+ }
84
+
76
85
@ Override
77
86
public boolean equals (Object o ) {
78
87
if (this == o ) {
@@ -90,14 +99,18 @@ public boolean equals(Object o) {
90
99
if (!Objects .equals (proxyConfiguration , that .proxyConfiguration )) {
91
100
return false ;
92
101
}
93
- return Objects .equals (healthConfiguration , that .healthConfiguration );
102
+ if (!Objects .equals (healthConfiguration , that .healthConfiguration )) {
103
+ return false ;
104
+ }
105
+ return Objects .equals (shouldTrustAllCertificates , that .shouldTrustAllCertificates );
94
106
}
95
107
96
108
@ Override
97
109
public int hashCode () {
98
110
int result = connectionTimeout != null ? connectionTimeout .hashCode () : 0 ;
99
111
result = 31 * result + (proxyConfiguration != null ? proxyConfiguration .hashCode () : 0 );
100
112
result = 31 * result + (healthConfiguration != null ? healthConfiguration .hashCode () : 0 );
113
+ result = 31 * result + (shouldTrustAllCertificates != null ? shouldTrustAllCertificates .hashCode () : 0 );
101
114
return result ;
102
115
}
103
116
@@ -115,6 +128,19 @@ public interface Builder extends CopyableBuilder<S3CrtHttpConfiguration.Builder,
115
128
*/
116
129
Builder connectionTimeout (Duration connectionTimeout );
117
130
131
+
132
+ /**
133
+ * <p>
134
+ * Option to disable SSL cert validation and SSL host name verification.
135
+ * This turns off x.509 validation.
136
+ * By default, this option is off.
137
+ * Only enable this option for testing purposes.
138
+ * </p>
139
+ * @param shouldTrustAllCertificates True if SSL cert validation is disabled.
140
+ * @return The builder of the method chaining.
141
+ */
142
+ Builder shouldTrustAllCertificates (Boolean shouldTrustAllCertificates );
143
+
118
144
/**
119
145
* Sets the http proxy configuration to use for this client.
120
146
*
@@ -165,6 +191,7 @@ Builder connectionHealthConfiguration(Consumer<S3CrtConnectionHealthConfiguratio
165
191
private static final class DefaultBuilder implements Builder {
166
192
private S3CrtConnectionHealthConfiguration healthConfiguration ;
167
193
private Duration connectionTimeout ;
194
+ private Boolean shouldTrustAllCertificates ;
168
195
private S3CrtProxyConfiguration proxyConfiguration ;
169
196
170
197
private DefaultBuilder () {
@@ -174,6 +201,7 @@ private DefaultBuilder(S3CrtHttpConfiguration httpConfiguration) {
174
201
this .healthConfiguration = httpConfiguration .healthConfiguration ;
175
202
this .connectionTimeout = httpConfiguration .connectionTimeout ;
176
203
this .proxyConfiguration = httpConfiguration .proxyConfiguration ;
204
+ this .shouldTrustAllCertificates = httpConfiguration .shouldTrustAllCertificates ;
177
205
}
178
206
179
207
@ Override
@@ -182,6 +210,12 @@ public Builder connectionTimeout(Duration connectionTimeout) {
182
210
return this ;
183
211
}
184
212
213
+ @ Override
214
+ public Builder shouldTrustAllCertificates (Boolean shouldTrustAllCertificates ) {
215
+ this .shouldTrustAllCertificates = shouldTrustAllCertificates ;
216
+ return this ;
217
+ }
218
+
185
219
@ Override
186
220
public Builder proxyConfiguration (S3CrtProxyConfiguration proxyConfiguration ) {
187
221
this .proxyConfiguration = proxyConfiguration ;
0 commit comments