Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to set the SASL mechanism to use SCRAM-SHA-256.
Kafka
props.put("sasl.mechanism", "[1]");
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using PLAIN instead of SCRAM-SHA-256
Misspelling the mechanism name
✗ Incorrect
The SASL mechanism must be set to SCRAM-SHA-256 to use that authentication method.
2fill in blank
mediumComplete the code to set the SASL JAAS config with username and password.
Kafka
props.put("sasl.jaas.config", "org.apache.kafka.common.security.scram.ScramLoginModule required username=\"[1]\" password=\"secret\";");
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong username
Forgetting to escape quotes properly
✗ Incorrect
The username in the JAAS config must match the Kafka user, here kafka.
3fill in blank
hardFix the error in the SASL mechanism property key name.
Kafka
props.put("[1]", "SCRAM-SHA-512");
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using plural or incorrect property keys
Adding extra suffixes to the key
✗ Incorrect
The correct property key for SASL mechanism is sasl.mechanism.
4fill in blank
hardFill both blanks to configure SASL with SCRAM-SHA-512 and set the username.
Kafka
props.put("sasl.mechanism", "[1]"); props.put("sasl.jaas.config", "org.apache.kafka.common.security.scram.ScramLoginModule required username=\"[2]\" password=\"mypassword\";");
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing mechanism names
Using wrong usernames
✗ Incorrect
Use SCRAM-SHA-512 for the mechanism and kafkaUser as the username.
5fill in blank
hardFill all three blanks to complete the SASL configuration with SCRAM-SHA-256, username, and password.
Kafka
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\";");
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong security protocol
Confusing SCRAM-SHA-256 with SCRAM-SHA-512
Incorrect username
✗ Incorrect
The SASL mechanism is SCRAM-SHA-256, the security protocol is SASL_SSL, and the username is kafkaUser.