Challenge - 5 Problems
SASL Authentication Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
SASL PLAIN Authentication Configuration Output
What will be the output of the following Kafka client configuration snippet when connecting with SASL PLAIN?
Kafka
props = {
'security.protocol': 'SASL_PLAINTEXT',
'sasl.mechanism': 'PLAIN',
'sasl.jaas.config': 'org.apache.kafka.common.security.plain.PlainLoginModule required username="user1" password="pass1";'
}
print(props['security.protocol'], props['sasl.mechanism'])Attempts:
2 left
💡 Hint
Check the values assigned to 'security.protocol' and 'sasl.mechanism' keys.
✗ Incorrect
The configuration sets 'security.protocol' to 'SASL_PLAINTEXT' and 'sasl.mechanism' to 'PLAIN', so printing these keys outputs 'SASL_PLAINTEXT PLAIN'.
❓ Predict Output
intermediate2:00remaining
SASL SCRAM Authentication Error Message
What error message will be raised if the Kafka client tries to connect using SASL SCRAM with an incorrect password?
Kafka
try: # Simulated connection attempt raise Exception('SASL authentication failed: Invalid credentials') except Exception as e: print(e)
Attempts:
2 left
💡 Hint
Focus on the exception message raised during authentication failure.
✗ Incorrect
When SASL SCRAM authentication fails due to wrong password, the client typically receives an 'Invalid credentials' error message.
🔧 Debug
advanced2:00remaining
Identify the SASL Authentication Bug
Given the following Kafka client configuration, which option correctly identifies the bug causing SASL authentication to fail?
Kafka
props = {
'security.protocol': 'SASL_SSL',
'sasl.mechanism': 'PLAIN',
'sasl.jaas.config': 'org.apache.kafka.common.security.plain.PlainLoginModule required username="admin" password="admin123"'
}
# Connection fails with authentication errorAttempts:
2 left
💡 Hint
Check the syntax of the JAAS config string carefully.
✗ Incorrect
The JAAS config string requires a semicolon at the end to separate statements. Missing it causes authentication failure.
📝 Syntax
advanced2:00remaining
SASL JAAS Configuration Syntax Error
Which option contains a syntax error in the SASL JAAS configuration string?
Attempts:
2 left
💡 Hint
Look at how username and password values are quoted.
✗ Incorrect
In JAAS config, username and password must be quoted strings. Option A lacks quotes, causing syntax error.
🚀 Application
expert2:00remaining
Determine the Number of SASL Mechanisms Supported
Given a Kafka broker configured with SASL mechanisms: PLAIN, SCRAM-SHA-256, SCRAM-SHA-512, and GSSAPI, how many SASL mechanisms can a client choose from to authenticate?
Attempts:
2 left
💡 Hint
Count all listed mechanisms available for SASL authentication.
✗ Incorrect
The broker supports four SASL mechanisms: PLAIN, SCRAM-SHA-256, SCRAM-SHA-512, and GSSAPI, so clients can choose any of these four.