THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
- If using a
SaslServer/SaslClient
implementation from the JRE, the callbacks required for the mechanism are described in the Java SASL reference. - When using the
SaslServer/SaslClient
implementation included in Kafka (PLAIN or SCRAM), the callback defined below for the required SASL mechanism must be handled. - Applications using custom implementations of
SaslServer/SaslClient
may define their own callbacks.
...
Code Block | ||||
---|---|---|---|---|
| ||||
package org.apache.kafka.common.security.auth; import org.apache.kafka.common.network.Mode; import java.util.Collection; import javax.security.auth.callback.CallbackHandler; public interface AuthCallbackHandler extends CallbackHandler { /** * Configures with the given key-value pairscallback handler for the specified SASL mechanism. */ void configure(Map<String, ?> configs, String saslMechanism); /** * Returns the connection mode supported by this callback handler. */ Mode mode(); /** * Returns the SASL mechanisms supported by this callback handler. */ Collection<String> supportedSaslMechanisms(); /** * Closes this instance. */ void close(); } |
SASL/PLAIN
...
Callbacks
Code Block | ||||
---|---|---|---|---|
| ||||
package org.apache.kafka.common.security.plain; import javax.security.auth.callback.Callback; public class PlainCredentialCallbackPlainAuthenticateCallback implements Callback { private final String username; private final String char[] password; private boolean authenticated; public PlainCredentialCallbackPlainAuthenticateCallback(String username, String char[] password) { this.username = username; this.password = password; } public String username() { return username; } public String char[] password() { return password; } public boolean authenticated() { return this.authenticated; } public void authenticated(boolean successauthenticated) { this.authenticated = successauthenticated; } } |
SASL/SCRAM Callback
Code Block | ||||
---|---|---|---|---|
| ||||
package org.apache.kafka.common.security.scram; import javax.security.auth.callback.Callback; public class ScramCredentialCallback implements Callback { private final String username; private String salt; private byte[] serverKey; private byte[] storedKey; private int iterationCount; public ScramCredentialCallback(String username) { this.username = username; } public String username() { return username; } public String salt() { return salt; } public void salt(String salt) { this.salt = salt; } public byte[] serverKey() { return serverKey; } public void serverKey(byte[] serverKey) { this.serverKey = serverKey; } public byte[] storedKey() { return storedKey; } public void storedKey(byte[] storedKey) { this.storedKey = storedKey; } public int iterationCount() { return iterationCount; } public void iterationCount(int iterationCount) { this.iterationCount = iterationCount; } } |
...