Complete the code to set the SASL mechanism to use SCRAM-SHA-256.
props.put("sasl.mechanism", "[1]");
The SASL mechanism must be set to SCRAM-SHA-256 to use that authentication method.
Complete the code to set the SASL JAAS config with username and password.
props.put("sasl.jaas.config", "org.apache.kafka.common.security.scram.ScramLoginModule required username=\"[1]\" password=\"secret\";");
The username in the JAAS config must match the Kafka user, here kafka.
Fix the error in the SASL mechanism property key name.
props.put("[1]", "SCRAM-SHA-512");
The correct property key for SASL mechanism is sasl.mechanism.
Fill both blanks to configure SASL with SCRAM-SHA-512 and set the username.
props.put("sasl.mechanism", "[1]"); props.put("sasl.jaas.config", "org.apache.kafka.common.security.scram.ScramLoginModule required username=\"[2]\" password=\"mypassword\";");
Use SCRAM-SHA-512 for the mechanism and kafkaUser as the username.
Fill all three blanks to complete the SASL configuration with SCRAM-SHA-256, username, and password.
props.put("sasl.mechanism", "[1]"); props.put("security.protocol", "[2]"); props.put("sasl.jaas.config", "org.apache.kafka.common.security.scram.ScramLoginModule required username=\"[3]\" password=\"pass123\";");
The SASL mechanism is SCRAM-SHA-256, the security protocol is SASL_SSL, and the username is kafkaUser.
