Ver Fonte

HADOOP-10432. Refactor SSLFactory to expose static method to determine HostnameVerifier. (tucu)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1586098 13f79535-47bb-0310-9956-ffa450edef68
Alejandro Abdelnur há 11 anos atrás
pai
commit
9a2ec694fe

+ 3 - 0
hadoop-common-project/hadoop-common/CHANGES.txt

@@ -127,6 +127,9 @@ Trunk (Unreleased)
     HADOOP-10237. JavaKeyStoreProvider needs to set keystore permissions 
     correctly. (Larry McCay via omalley)
 
+    HADOOP-10432. Refactor SSLFactory to expose static method to determine
+    HostnameVerifier. (tucu)
+
   BUG FIXES
 
     HADOOP-9451. Fault single-layer config if node group topology is enabled.

+ 6 - 2
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/SSLFactory.java

@@ -127,10 +127,14 @@ public class SSLFactory implements ConnectionConfigurator {
   }
 
   private HostnameVerifier getHostnameVerifier(Configuration conf)
+      throws GeneralSecurityException, IOException {
+    return getHostnameVerifier(conf.get(SSL_HOSTNAME_VERIFIER_KEY, "DEFAULT").
+        trim().toUpperCase());
+  }
+
+  public static HostnameVerifier getHostnameVerifier(String verifier)
     throws GeneralSecurityException, IOException {
     HostnameVerifier hostnameVerifier;
-    String verifier =
-      conf.get(SSL_HOSTNAME_VERIFIER_KEY, "DEFAULT").trim().toUpperCase();
     if (verifier.equals("DEFAULT")) {
       hostnameVerifier = SSLHostnameVerifier.DEFAULT;
     } else if (verifier.equals("DEFAULT_AND_LOCALHOST")) {