markrmiller commented on a change in pull request #585:
URL: https://github.com/apache/solr/pull/585#discussion_r810457269



##########
File path: 
solr/modules/s3-repository/src/test/org/apache/solr/s3/S3BackupRepositoryTest.java
##########
@@ -320,17 +340,113 @@ protected URI getBaseUri() throws URISyntaxException {
   }
 
   private void pushObject(String path, String content) {
-    try (S3Client s3 = S3_MOCK_RULE.createS3ClientV2()) {
+    try (S3Client s3 = createS3ClientV2()) {
       s3.putObject(b -> b.bucket(BUCKET_NAME).key(path), 
RequestBody.fromString(content));
     }
   }
 
   private File pullObject(String path) throws IOException {
-    try (S3Client s3 = S3_MOCK_RULE.createS3ClientV2()) {
+    try (S3Client s3 = createS3ClientV2()) {
       File file = temporaryFolder.newFile();
       InputStream input = s3.getObject(b -> b.bucket(BUCKET_NAME).key(path));
       FileUtils.copyInputStreamToFile(input, file);
       return file;
     }
   }
+
+  public S3Client createS3ClientV2() {
+    return S3Client.builder()
+        .region(Region.of("us-east-1"))
+        .credentialsProvider(
+            StaticCredentialsProvider.create(AwsBasicCredentials.create("foo", 
"bar")))
+        .endpointOverride(URI.create(S3_MOCK_RULE.getServiceEndpoint()))
+        .httpClient(
+            UrlConnectionHttpClient.builder()
+                .buildWithDefaults(
+                    AttributeMap.builder()
+                        .put(
+                            new HttpConfigurationOption("secureConnection", 
Boolean.class),
+                            Boolean.FALSE)
+                        .build()))
+        .build();
+  }
+
+  public ClientConfiguration configureClientToIgnoreInvalidSslCertificates(
+      final ClientConfiguration clientConfiguration) {
+
+    clientConfiguration
+        .getApacheHttpClientConfig()
+        .withSslSocketFactory(
+            new SSLConnectionSocketFactory(
+                createBlindlyTrustingSslContext(), 
NoopHostnameVerifier.INSTANCE));
+
+    return clientConfiguration;
+  }
+
+  private SSLContext createBlindlyTrustingSslContext() {
+    try {
+      final SSLContext sc = SSLContext.getInstance("TLS");
+
+      sc.init(
+          null,
+          new TrustManager[] {
+            new X509ExtendedTrustManager() {
+              @Override
+              public java.security.cert.X509Certificate[] getAcceptedIssuers() 
{
+                return null;
+              }
+
+              @Override
+              public void checkClientTrusted(
+                  final X509Certificate[] arg0, final String arg1, final 
Socket arg2) {
+                // no-op
+              }
+
+              @Override
+              public void checkClientTrusted(
+                  final X509Certificate[] arg0, final String arg1, final 
SSLEngine arg2) {
+                // no-op
+              }
+
+              @Override
+              public void checkClientTrusted(final X509Certificate[] certs, 
final String authType) {
+                // no-op
+              }
+
+              @Override
+              public void checkServerTrusted(final X509Certificate[] certs, 
final String authType) {
+                // no-op
+              }
+
+              @Override
+              public void checkServerTrusted(
+                  final X509Certificate[] arg0, final String arg1, final 
Socket arg2) {
+                // no-op
+              }
+
+              @Override
+              public void checkServerTrusted(
+                  final X509Certificate[] arg0, final String arg1, final 
SSLEngine arg2) {
+                // no-op
+              }
+            }
+          },
+          new java.security.SecureRandom());

Review comment:
       Maybe, but unrelated to the jetty changes. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to