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

Adds SASLOAuthBearer flow to AIO Kafka's Faststream Security Parsing #1761

Merged
merged 9 commits into from
Sep 5, 2024

Conversation

sifex
Copy link
Contributor

@sifex sifex commented Sep 5, 2024

Description

This PR adds SASLOAuthBearer flow to the AIOKafka driver to match the Confluent implementation as closely as possible.

Reference:
https://faststream.airt.ai/latest/confluent/security/#4-sasloauthbearer-object-with-ssltls

Basic implimentation would look like:

import ssl

from faststream.kafka import KafkaBroker
from faststream.security import SASLOAuthBearer

ssl_context = ssl.create_default_context()
security = SASLOAuthBearer(
    use_ssl=True,
    ssl_context=ssl_context
)

broker = KafkaBroker(
    "localhost:9092",
    security=security,
    sasl_oauth_token_provider=...
)

where sasl_oauth_token_provider is an instance of a class that implements AbstractTokenProvider.

Type of change

Please delete options that are not relevant.

  • Documentation (typos, code examples, or any documentation updates)
  • Bug fix (a non-breaking change that resolves an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a fix or feature that would disrupt existing functionality)
  • This change requires a documentation update

Checklist

  • My code adheres to the style guidelines of this project (scripts/lint.sh shows no errors)
  • I have conducted a self-review of my own code
  • I have made the necessary changes to the documentation
  • My changes do not generate any new warnings
  • I have added tests to validate the effectiveness of my fix or the functionality of my new feature
  • Both new and existing unit tests pass successfully on my local environment by running scripts/test-cov.sh
  • I have ensured that static analysis tests are passing by running scripts/static-analysis.sh
  • I have included code examples to illustrate the modifications

@Lancetnik Lancetnik added this pull request to the merge queue Sep 5, 2024
Merged via the queue into airtai:main with commit 9492712 Sep 5, 2024
31 checks passed
@sifex
Copy link
Contributor Author

sifex commented Sep 5, 2024

Thanks @Lancetnik ❤️

@Lancetnik
Copy link
Member

@sifex thank you for your PR! I plan to make release today, so you are just in time 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants