Skip to content

Commit 40cd459

Browse files
committed
Address review comments.
1 parent 11ac338 commit 40cd459

File tree

6 files changed

+11
-21
lines changed

6 files changed

+11
-21
lines changed

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslMechanismFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
/**
3131
* SASL related constants.
3232
*/
33-
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
33+
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce", "YARN", "HBase"})
3434
@InterfaceStability.Evolving
3535
public final class SaslMechanismFactory {
3636
static final Logger LOG = LoggerFactory.getLogger(SaslMechanismFactory.class);
@@ -44,7 +44,7 @@ public final class SaslMechanismFactory {
4444
LOG.debug("{} = {} (env)", SASL_MECHANISM_ENV, envValue);
4545

4646
// conf
47-
final Configuration conf = new Configuration();
47+
final Configuration conf = new Configuration(false);
4848
final String confValue = conf.get(HADOOP_SECURITY_SASL_MECHANISM_KEY,
4949
HADOOP_SECURITY_SASL_MECHANISM_DEFAULT);
5050
LOG.debug("{} = {} (conf)", HADOOP_SECURITY_SASL_MECHANISM_KEY, confValue);

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/package-info.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@
1919
/**
2020
* Classes for hadoop security.
2121
*/
22-
package org.apache.hadoop.security;
22+
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce", "YARN", "HBase"})
23+
package org.apache.hadoop.security;
24+
25+
import org.apache.hadoop.classification.InterfaceAudience;

hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/HdfsClientConfigKeys.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,6 @@ public interface HdfsClientConfigKeys {
236236
String DFS_DATA_TRANSFER_SASL_PROPS_RESOLVER_CLASS_KEY =
237237
"dfs.data.transfer.saslproperties.resolver.class";
238238

239-
String DFS_DATA_TRANSFER_SASL_CUSTOMIZEDCALLBACKHANDLER_CLASS_KEY
240-
= "dfs.data.transfer.sasl.CustomizedCallbackHandler.class";
241-
242239
String DFS_ENCRYPT_DATA_TRANSFER_CIPHER_KEY_BITLENGTH_KEY =
243240
"dfs.encrypt.data.transfer.cipher.key.bitlength";
244241
int DFS_ENCRYPT_DATA_TRANSFER_CIPHER_KEY_BITLENGTH_DEFAULT = 128;

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/SaslDataTransferServer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818
package org.apache.hadoop.hdfs.protocol.datatransfer.sasl;
1919

20+
import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.HADOOP_SECURITY_SASL_CUSTOMIZEDCALLBACKHANDLER_CLASS_KEY;
2021
import static org.apache.hadoop.hdfs.client.HdfsClientConfigKeys.DFS_DATA_TRANSFER_PROTECTION_KEY;
2122
import static org.apache.hadoop.hdfs.client.HdfsClientConfigKeys.DFS_ENCRYPT_DATA_TRANSFER_CIPHER_SUITES_KEY;
2223
import static org.apache.hadoop.hdfs.protocol.datatransfer.sasl.DataTransferSaslUtil.*;
@@ -47,7 +48,6 @@
4748
import org.apache.hadoop.classification.InterfaceAudience;
4849
import org.apache.hadoop.conf.Configuration;
4950
import org.apache.hadoop.crypto.CipherOption;
50-
import org.apache.hadoop.hdfs.client.HdfsClientConfigKeys;
5151
import org.apache.hadoop.hdfs.net.Peer;
5252
import org.apache.hadoop.hdfs.protocol.DatanodeID;
5353
import org.apache.hadoop.hdfs.protocol.datatransfer.IOStreamPair;
@@ -226,7 +226,7 @@ static final class SaslServerCallbackHandler
226226
SaslServerCallbackHandler(Configuration conf, PasswordFunction passwordFunction) {
227227
this.passwordFunction = passwordFunction;
228228
this.customizedCallbackHandler = CustomizedCallbackHandler.get(
229-
HdfsClientConfigKeys.DFS_DATA_TRANSFER_SASL_CUSTOMIZEDCALLBACKHANDLER_CLASS_KEY, conf);
229+
HADOOP_SECURITY_SASL_CUSTOMIZEDCALLBACKHANDLER_CLASS_KEY, conf);
230230
}
231231

232232
@Override

hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2641,15 +2641,6 @@
26412641
</description>
26422642
</property>
26432643

2644-
<property>
2645-
<name>dfs.data.transfer.sasl.CustomizedCallbackHandler.class</name>
2646-
<value></value>
2647-
<description>
2648-
Some security provider may define a new javax.security.auth.callback.Callback.
2649-
This property allows users to configure a customized callback handler.
2650-
</description>
2651-
</property>
2652-
26532644
<property>
26542645
<name>dfs.journalnode.rpc-address</name>
26552646
<value>0.0.0.0:8485</value>

hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/TestCustomizedCallbackHandler.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
package org.apache.hadoop.hdfs.protocol.datatransfer.sasl;
1919

2020
import org.apache.hadoop.conf.Configuration;
21-
import org.apache.hadoop.hdfs.client.HdfsClientConfigKeys;
2221
import org.apache.hadoop.hdfs.protocol.datatransfer.sasl.SaslDataTransferServer.SaslServerCallbackHandler;
2322
import org.apache.hadoop.security.CustomizedCallbackHandler;
2423
import org.apache.hadoop.security.SaslRpcServer;
@@ -82,7 +81,7 @@ public void testCustomizedCallbackHandler() throws Exception {
8281

8382
// set conf and expect success
8483
reset();
85-
conf.setClass(HdfsClientConfigKeys.DFS_DATA_TRANSFER_SASL_CUSTOMIZEDCALLBACKHANDLER_CLASS_KEY,
84+
conf.setClass(HADOOP_SECURITY_SASL_CUSTOMIZEDCALLBACKHANDLER_CLASS_KEY,
8685
MyCallbackHandler.class, CustomizedCallbackHandler.class);
8786
runTest(conf, callbacks);
8887
assertCallbacks(callbacks);
@@ -120,14 +119,14 @@ public void testCustomizedCallbackMethod() throws Exception {
120119

121120
// set conf and expect success
122121
reset();
123-
conf.setClass(HdfsClientConfigKeys.DFS_DATA_TRANSFER_SASL_CUSTOMIZEDCALLBACKHANDLER_CLASS_KEY,
122+
conf.setClass(HADOOP_SECURITY_SASL_CUSTOMIZEDCALLBACKHANDLER_CLASS_KEY,
124123
MyCallbackMethod.class, Object.class);
125124
runTest(conf, callbacks);
126125
assertCallbacks(callbacks);
127126

128127
// set conf and expect exception
129128
reset();
130-
conf.setClass(HdfsClientConfigKeys.DFS_DATA_TRANSFER_SASL_CUSTOMIZEDCALLBACKHANDLER_CLASS_KEY,
129+
conf.setClass(HADOOP_SECURITY_SASL_CUSTOMIZEDCALLBACKHANDLER_CLASS_KEY,
131130
MyExceptionMethod.class, Object.class);
132131
LambdaTestUtils.intercept(IOException.class, () -> runTest(conf, callbacks));
133132
}

0 commit comments

Comments
 (0)