Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct the SchemaRegistry authentication for SASL_INHERIT #733

Merged
merged 7 commits into from
Mar 17, 2020
4 changes: 2 additions & 2 deletions confluent_kafka/avro/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(self, config, default_key_schema=None,
for key, value in config.items() if key.startswith("schema.registry")}

if sr_conf.get("basic.auth.credentials.source") == 'SASL_INHERIT':
sr_conf['sasl.mechanisms'] = config.get('sasl.mechanisms', '')
sr_conf['sasl.mechanism'] = config.get('sasl.mechanism', '')
abij marked this conversation as resolved.
Show resolved Hide resolved
sr_conf['sasl.username'] = config.get('sasl.username', '')
sr_conf['sasl.password'] = config.get('sasl.password', '')

Expand Down Expand Up @@ -110,7 +110,7 @@ def __init__(self, config, schema_registry=None, reader_key_schema=None, reader_
for key, value in config.items() if key.startswith("schema.registry")}

if sr_conf.get("basic.auth.credentials.source") == 'SASL_INHERIT':
sr_conf['sasl.mechanisms'] = config.get('sasl.mechanisms', '')
sr_conf['sasl.mechanism'] = config.get('sasl.mechanism', '')
abij marked this conversation as resolved.
Show resolved Hide resolved
sr_conf['sasl.username'] = config.get('sasl.username', '')
sr_conf['sasl.password'] = config.get('sasl.password', '')

Expand Down
4 changes: 2 additions & 2 deletions confluent_kafka/avro/cached_schema_registry_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ def _configure_basic_auth(conf):
raise ValueError("schema.registry.basic.auth.credentials.source must be one of {}"
.format(VALID_AUTH_PROVIDERS))
if auth_provider == 'SASL_INHERIT':
if conf.pop('sasl.mechanism', '').upper() is ['GSSAPI']:
raise ValueError("SASL_INHERIT does not support SASL mechanisms GSSAPI")
if conf.pop('sasl.mechanism', '').upper() == 'GSSAPI':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

raise ValueError("SASL_INHERIT does not support SASL mechanism GSSAPI")
auth = (conf.pop('sasl.username', ''), conf.pop('sasl.password', ''))
elif auth_provider == 'USER_INFO':
auth = tuple(conf.pop('basic.auth.user.info', '').split(':'))
Expand Down
4 changes: 2 additions & 2 deletions examples/confluent_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

p = Producer({
'bootstrap.servers': '<ccloud bootstrap servers>',
'sasl.mechanisms': 'PLAIN',
'sasl.mechanism': 'PLAIN',
'security.protocol': 'SASL_SSL',
'sasl.username': '<ccloud key>',
'sasl.password': '<ccloud secret>'
Expand All @@ -78,7 +78,7 @@ def acked(err, msg):

c = Consumer({
'bootstrap.servers': '<ccloud bootstrap servers>',
'sasl.mechanisms': 'PLAIN',
'sasl.mechanism': 'PLAIN',
'security.protocol': 'SASL_SSL',
'sasl.username': '<ccloud key>',
'sasl.password': '<ccloud secret>',
Expand Down