Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It looks like someone beat me to a pull request by a few hours, but I thought I'd submit this in case this code is useful.
I've used against Kafka 2.2.1 and 2.3.0 with Python 2.7.15 and 3.6.8. I've only used security mechanism of SCRAM-SHA-512 (not SCRAM-SHA-256). I've tried it with security protocols of SASL_PLAINTEXT and SASL_SSL.
The code re-uses sasl_plain_username and sasl_plain_password. That makes these names a little inaccurate, but having separate sasl_scram_username and sasl_scram_password didn’t seem like a great option, either. Another option would be to introduce sasl_username and sasl_password that both mechanisms use and deprecate sasl_plain_*
I didn’t follow the exact style of conn._try_authentiate_plain and conn._try_authenticate_gssapi because there are more errors that can occur. I relied on exceptions more than in those functions.
This change is