Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2673,7 +2673,7 @@ private RpcSaslProto buildSaslNegotiateResponse()
// accelerate token negotiation by sending initial challenge
// in the negotiation response
if (enabledAuthMethods.contains(AuthMethod.TOKEN)
&& SaslMechanismFactory.isDefaultMechanism(AuthMethod.TOKEN.getMechanismName())) {
&& SaslMechanismFactory.isDigestMechanism(AuthMethod.TOKEN.getMechanismName())) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inside of matching just DIGEST-MD5, match any mechanisms starting with DIGEST-*

What mechanisms do we have in mind? I am only aware of DIGEST-MD5. Others may be possible but not standardized.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DIGEST-MD5 uses MD5 and some other old algorithms. We are working with a new DIGEST based mechanism for replacing the old algorithms.

saslServer = createSaslServer(AuthMethod.TOKEN);
byte[] challenge = saslServer.evaluateResponse(new byte[0]);
RpcSaslProto.Builder negotiateBuilder =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private static synchronized CustomizedCallbackHandler getSynchronously(

//cache miss
final Class<?> clazz = conf.getClass(key, DefaultHandler.class);
LOG.info("{} = {}", key, clazz);
LOG.debug("{} = {}", key, clazz);
if (clazz == DefaultHandler.class) {
return DefaultHandler.INSTANCE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,13 @@ public static boolean isDefaultMechanism(String saslMechanism) {
return HADOOP_SECURITY_SASL_MECHANISM_DEFAULT.equals(saslMechanism);
}

public static boolean isDigestMechanism(String saslMechanism) {
return saslMechanism.startsWith("DIGEST-");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe consider using hadoop.security.sasl.mechanism to ensure the value is expected?


  <property>
    <name>hadoop.security.sasl.mechanism</name>
    <value>DIGEST-MD5</value>
    <description>
      The SASL mechanism used in Hadoop.
    </description>
  </property>

Copy link
Contributor Author

@szetszwo szetszwo Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In some cases, conf objects are unavailable.

}

private SaslMechanismFactory() {}

public static void main(String[] args) {
System.out.println("SASL_MECHANISM = " + getMechanism());
}
}