@@ -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 trustAllCertificatesEnabled ;
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 .trustAllCertificatesEnabled = builder .trustAllCertificatesEnabled ;
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#trustAllCertificatesEnabled}.
80
+ */
81
+ public Boolean trustAllCertificatesEnabled () {
82
+ return trustAllCertificatesEnabled ;
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 (trustAllCertificatesEnabled , that .trustAllCertificatesEnabled );
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 + (trustAllCertificatesEnabled != null ? trustAllCertificatesEnabled .hashCode () : 0 );
101
114
return result ;
102
115
}
103
116
@@ -115,6 +128,18 @@ 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
+ * @param trustAllCertificatesEnabled True if SSL cert validation is disabled.
139
+ * @return The builder of the method chaining.
140
+ */
141
+ Builder trustAllCertificatesEnabled (Boolean trustAllCertificatesEnabled );
142
+
118
143
/**
119
144
* Sets the http proxy configuration to use for this client.
120
145
*
@@ -165,6 +190,7 @@ Builder connectionHealthConfiguration(Consumer<S3CrtConnectionHealthConfiguratio
165
190
private static final class DefaultBuilder implements Builder {
166
191
private S3CrtConnectionHealthConfiguration healthConfiguration ;
167
192
private Duration connectionTimeout ;
193
+ private Boolean trustAllCertificatesEnabled ;
168
194
private S3CrtProxyConfiguration proxyConfiguration ;
169
195
170
196
private DefaultBuilder () {
@@ -174,6 +200,7 @@ private DefaultBuilder(S3CrtHttpConfiguration httpConfiguration) {
174
200
this .healthConfiguration = httpConfiguration .healthConfiguration ;
175
201
this .connectionTimeout = httpConfiguration .connectionTimeout ;
176
202
this .proxyConfiguration = httpConfiguration .proxyConfiguration ;
203
+ this .trustAllCertificatesEnabled = httpConfiguration .trustAllCertificatesEnabled ;
177
204
}
178
205
179
206
@ Override
@@ -182,6 +209,12 @@ public Builder connectionTimeout(Duration connectionTimeout) {
182
209
return this ;
183
210
}
184
211
212
+ @ Override
213
+ public Builder trustAllCertificatesEnabled (Boolean trustAllCertificatesEnabled ) {
214
+ this .trustAllCertificatesEnabled = trustAllCertificatesEnabled ;
215
+ return this ;
216
+ }
217
+
185
218
@ Override
186
219
public Builder proxyConfiguration (S3CrtProxyConfiguration proxyConfiguration ) {
187
220
this .proxyConfiguration = proxyConfiguration ;
0 commit comments