Skip to content

How to check for SASL Authentication Errors? #1398

Open
@mkmoisen

Description

@mkmoisen

Description

from confluent_kafka import Consumer

conf = {
    'bootstrap.servers': 'localhost:8082',
    'group.id': 'myconsumer',
    'security.protocol': 'sasl_ssl',
    'sasl.mechanism': 'PLAIN',
    'sasl.username': 'myusername',
    'sasl.password': 'badpassword'
}

consumer = Consumer(conf)

Invoking the code above with an incorrect password does not raise any error. It seems like it asynchronously attempts to authorize, and after a few seconds a separate thread will print the following to the screen:

%3|1658355875.069|FAIL|rdkafka#consumer-1| [thrd:sasl_ssl://localhost:9092/boots]: sasl_ssl://localhost:9092/bootstrap: SASL authentication error: Authentication failed (after 5170ms in state AUTH_REQ, 5 identical error(s) suppressed)

If I then subscribe to a topic and poll, on_assign is never called and the message is never polled.

How do I figure out if I've been correctly authorized?

Would it perhaps be better if it raised a synchronous exception?

Checklist

Please provide the following information:

  • confluent-kafka-python and librdkafka version (confluent_kafka.version() and confluent_kafka.libversion()):

    1.8.2 and 1.8.2

Metadata

Metadata

Assignees

Labels

enhancementRequesting a feature changepriority:highMaintainer triage tag for indicating high impact or criticality issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy