You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by rk...@apache.org on 2017/05/03 00:51:37 UTC
hadoop git commit: HADOOP-14352. Make some HttpServer2 SSL properties
optional (jzhuge via rkanter)
Repository: hadoop
Updated Branches:
refs/heads/trunk cedaf4cab -> 8b82317fa
HADOOP-14352. Make some HttpServer2 SSL properties optional (jzhuge via rkanter)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/8b82317f
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/8b82317f
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/8b82317f
Branch: refs/heads/trunk
Commit: 8b82317fab0cb3023da333d4d557e226712a9c92
Parents: cedaf4c
Author: Robert Kanter <rk...@apache.org>
Authored: Tue May 2 17:51:28 2017 -0700
Committer: Robert Kanter <rk...@apache.org>
Committed: Tue May 2 17:51:28 2017 -0700
----------------------------------------------------------------------
.../org/apache/hadoop/http/HttpServer2.java | 45 ++++++++++++--------
1 file changed, 27 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/8b82317f/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java
index cbabb33..0891e8e 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java
@@ -348,18 +348,17 @@ public final class HttpServer2 implements FilterContainer {
/**
* A wrapper of {@link Configuration#getPassword(String)}. It returns
- * <code>String</code> instead of <code>char[]</code> and throws
- * {@link IOException} when the password not found.
+ * <code>String</code> instead of <code>char[]</code>.
*
* @param conf the configuration
* @param name the property name
- * @return the password string
+ * @return the password string or null
*/
- private static String getPassword(Configuration conf, String name)
+ private static String getPasswordString(Configuration conf, String name)
throws IOException {
char[] passchars = conf.getPassword(name);
if (passchars == null) {
- throw new IOException("Password " + name + " not found");
+ return null;
}
return new String(passchars);
}
@@ -371,20 +370,30 @@ public final class HttpServer2 implements FilterContainer {
if (sslConf == null) {
return;
}
- needsClientAuth(sslConf.getBoolean(
+ needsClientAuth = sslConf.getBoolean(
SSLFactory.SSL_SERVER_NEED_CLIENT_AUTH,
- SSLFactory.SSL_SERVER_NEED_CLIENT_AUTH_DEFAULT));
- keyStore(sslConf.get(SSLFactory.SSL_SERVER_KEYSTORE_LOCATION),
- getPassword(sslConf, SSLFactory.SSL_SERVER_KEYSTORE_PASSWORD),
- sslConf.get(SSLFactory.SSL_SERVER_KEYSTORE_TYPE,
- SSLFactory.SSL_SERVER_KEYSTORE_TYPE_DEFAULT));
- keyPassword(getPassword(sslConf,
- SSLFactory.SSL_SERVER_KEYSTORE_KEYPASSWORD));
- trustStore(sslConf.get(SSLFactory.SSL_SERVER_TRUSTSTORE_LOCATION),
- getPassword(sslConf, SSLFactory.SSL_SERVER_TRUSTSTORE_PASSWORD),
- sslConf.get(SSLFactory.SSL_SERVER_TRUSTSTORE_TYPE,
- SSLFactory.SSL_SERVER_TRUSTSTORE_TYPE_DEFAULT));
- excludeCiphers(sslConf.get(SSLFactory.SSL_SERVER_EXCLUDE_CIPHER_LIST));
+ SSLFactory.SSL_SERVER_NEED_CLIENT_AUTH_DEFAULT);
+ keyStore = sslConf.getTrimmed(SSLFactory.SSL_SERVER_KEYSTORE_LOCATION);
+ if (keyStore == null || keyStore.isEmpty()) {
+ throw new IOException(String.format("Property %s not specified",
+ SSLFactory.SSL_SERVER_KEYSTORE_LOCATION));
+ }
+ keyStorePassword = getPasswordString(sslConf,
+ SSLFactory.SSL_SERVER_KEYSTORE_PASSWORD);
+ if (keyStorePassword == null) {
+ throw new IOException(String.format("Property %s not specified",
+ SSLFactory.SSL_SERVER_KEYSTORE_PASSWORD));
+ }
+ keyStoreType = sslConf.get(SSLFactory.SSL_SERVER_KEYSTORE_TYPE,
+ SSLFactory.SSL_SERVER_KEYSTORE_TYPE_DEFAULT);
+ keyPassword = getPasswordString(sslConf,
+ SSLFactory.SSL_SERVER_KEYSTORE_KEYPASSWORD);
+ trustStore = sslConf.get(SSLFactory.SSL_SERVER_TRUSTSTORE_LOCATION);
+ trustStorePassword = getPasswordString(sslConf,
+ SSLFactory.SSL_SERVER_TRUSTSTORE_PASSWORD);
+ trustStoreType = sslConf.get(SSLFactory.SSL_SERVER_TRUSTSTORE_TYPE,
+ SSLFactory.SSL_SERVER_TRUSTSTORE_TYPE_DEFAULT);
+ excludeCiphers = sslConf.get(SSLFactory.SSL_SERVER_EXCLUDE_CIPHER_LIST);
}
public HttpServer2 build() throws IOException {
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org