You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by pv...@apache.org on 2021/07/29 07:44:55 UTC

[nifi] branch main updated: NIFI-8956 Changed TestListenHTTP to expect IOException

This is an automated email from the ASF dual-hosted git repository.

pvillard pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new f539d98  NIFI-8956 Changed TestListenHTTP to expect IOException
f539d98 is described below

commit f539d9886e3e0f3f1068e9e13af0988dae70377a
Author: exceptionfactory <ex...@apache.org>
AuthorDate: Wed Jul 28 17:57:22 2021 -0500

    NIFI-8956 Changed TestListenHTTP to expect IOException
    
    - Replaced expected SSLException with IOException in assertThrows
    - Removed conditional override of jdk.tls.disabledAlgorithms in test SslContextUtils
    
    Signed-off-by: Pierre Villard <pi...@gmail.com>
    
    This closes #5260.
---
 .../nifi/processors/standard/TestListenHTTP.java     |  5 ++---
 .../apache/nifi/web/util/ssl/SslContextUtils.java    | 20 --------------------
 2 files changed, 2 insertions(+), 23 deletions(-)

diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListenHTTP.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListenHTTP.java
index 1fa32ad..48d911e 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListenHTTP.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListenHTTP.java
@@ -31,7 +31,6 @@ import java.util.List;
 import java.util.Optional;
 import java.util.Random;
 import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLException;
 import javax.net.ssl.SSLHandshakeException;
 import javax.net.ssl.SSLSession;
 import javax.net.ssl.SSLSocket;
@@ -391,7 +390,7 @@ public class TestListenHTTP {
     public void testSecureServerTrustStoreConfiguredClientAuthenticationRequired() throws Exception {
         configureProcessorSslContextService(ListenHTTP.ClientAuthentication.REQUIRED, serverConfiguration);
         startSecureServer();
-        assertThrows(SSLException.class, () -> postMessage(null, true, false));
+        assertThrows(IOException.class, () -> postMessage(null, true, false));
     }
 
     @Test
@@ -493,7 +492,7 @@ public class TestListenHTTP {
         startWebServer();
     }
 
-    private int postMessage(String message, boolean secure, boolean clientAuthRequired) throws Exception {
+    private int postMessage(String message, boolean secure, boolean clientAuthRequired) throws IOException {
         final OkHttpClient okHttpClient = getOkHttpClient(secure, clientAuthRequired);
         final Request.Builder requestBuilder = new Request.Builder();
         final String url = buildUrl(secure);
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-web-test-utils/src/main/java/org/apache/nifi/web/util/ssl/SslContextUtils.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-web-test-utils/src/main/java/org/apache/nifi/web/util/ssl/SslContextUtils.java
index b647b1a..0ca1fc4 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-web-test-utils/src/main/java/org/apache/nifi/web/util/ssl/SslContextUtils.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-web-test-utils/src/main/java/org/apache/nifi/web/util/ssl/SslContextUtils.java
@@ -22,31 +22,11 @@ import org.apache.nifi.security.util.SslContextFactory;
 import org.apache.nifi.security.util.StandardTlsConfiguration;
 import org.apache.nifi.security.util.TlsConfiguration;
 import org.apache.nifi.security.util.TlsException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import javax.net.ssl.SSLContext;
 import java.io.File;
-import java.security.Security;
 
 public class SslContextUtils {
-    private static final Logger LOGGER = LoggerFactory.getLogger(SslContextUtils.class);
-
-    private static final String TLS_DISABLED_ALGORITHMS_PROPERTY = "jdk.tls.disabledAlgorithms";
-
-    private static final String DISABLED_ALGORITHMS = "SSLv3, RC4, DES, MD5withRSA, DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL, include jdk.disabled.namedCurves";
-
-    static {
-        final String disabledAlgorithms = Security.getProperty(TLS_DISABLED_ALGORITHMS_PROPERTY);
-        if (DISABLED_ALGORITHMS.equals(disabledAlgorithms)) {
-            LOGGER.debug("Found Expected Default TLS Disabled Algorithms: {}", DISABLED_ALGORITHMS);
-        } else {
-            LOGGER.warn("Found System Default TLS Disabled Algorithms: {}", disabledAlgorithms);
-            LOGGER.warn("Setting TLS Disabled Algorithms: {}", DISABLED_ALGORITHMS);
-            Security.setProperty(TLS_DISABLED_ALGORITHMS_PROPERTY, DISABLED_ALGORITHMS);
-        }
-    }
-
     private static final String KEYSTORE_PATH = "src/test/resources/keystore.jks";
 
     private static final String KEYSTORE_AND_TRUSTSTORE_PASSWORD = "passwordpassword";