[ https://issues.apache.org/jira/browse/HDFS-17606?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17875229#comment-17875229 ]
ASF GitHub Bot commented on HDFS-17606: --------------------------------------- szetszwo commented on code in PR #7005: URL: https://github.com/apache/hadoop/pull/7005#discussion_r1723575317 ########## hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/TestCustomizedCallbackHandler.java: ########## @@ -20,25 +20,43 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hdfs.client.HdfsClientConfigKeys; import org.apache.hadoop.hdfs.protocol.datatransfer.sasl.SaslDataTransferServer.SaslServerCallbackHandler; +import org.apache.hadoop.test.LambdaTestUtils; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.security.auth.callback.Callback; import javax.security.auth.callback.UnsupportedCallbackException; -import java.util.Arrays; +import java.io.IOException; import java.util.List; +import java.util.concurrent.atomic.AtomicReference; public class TestCustomizedCallbackHandler { public static final Logger LOG = LoggerFactory.getLogger(TestCustomizedCallbackHandler.class); + static final AtomicReference<List<Callback>> LAST_CALLBACKS = new AtomicReference<>(); + + static void runHandleCallbacks(Object caller, List<Callback> callbacks, String name) { + LOG.info("{}: handling {} for {}", caller.getClass().getSimpleName(), callbacks, name); + LAST_CALLBACKS.set(callbacks); + } + + static void assertCallbacks(Callback[] expected) { + final List<Callback> computed = LAST_CALLBACKS.getAndSet(null); + Assert.assertNotNull(computed); Review Comment: Tried it but `AssertJ` was not available for import. So I will keep the current code and avoid adding the dependency. > Do not require implementing CustomizedCallbackHandler > ----------------------------------------------------- > > Key: HDFS-17606 > URL: https://issues.apache.org/jira/browse/HDFS-17606 > Project: Hadoop HDFS > Issue Type: Improvement > Components: security > Reporter: Tsz-wo Sze > Assignee: Tsz-wo Sze > Priority: Major > Labels: pull-request-available > > HDFS-17576 added a CustomizedCallbackHandler interface which declares the > following method: > {code} > void handleCallback(List<Callback> callbacks, String name, char[] password) > throws UnsupportedCallbackException, IOException; > {code} > This Jira is to allow an implementation to define the handleCallback method > without implementing the CustomizedCallbackHandler interface. It is to avoid > a security provider depending on the HDFS project. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org