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

feat: add oauth support #1632

Merged
merged 14 commits into from
Aug 4, 2024
Merged

feat: add oauth support #1632

merged 14 commits into from
Aug 4, 2024

Conversation

filip-danieluk
Copy link
Contributor

@filip-danieluk filip-danieluk commented Jul 29, 2024

Description

Please include a summary of the change and specify which issue is being addressed. Additionally, provide relevant motivation and context.

Fixes #1631

Type of change

  • New feature (a non-breaking change that adds functionality)

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

Copy link
Member

@Lancetnik Lancetnik left a comment

Choose a reason for hiding this comment

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

@filip-danieluk
Copy link
Contributor Author

filip-danieluk commented Jul 29, 2024

Hi @Lancetnik, I intend to do that however atm I struggle running test suite at all, pytest -m 'confluent' results in a segmentation fault on my machine. Same behaviour when I cloned clean faststream repo without my changes. Does that ring any bells? It's 6th or 7th test in order that fails in this way.

@Lancetnik
Copy link
Member

Lancetnik commented Jul 29, 2024

Hi @Lancetnik, I intend to do that however atm I struggle running test suite at all, pytest -m 'confluent' results in a segmentation fault on my machine. Same behaviour when I cloned clean faststream repo without my changes. Does that ring any bells? It's 6th or 7th test in order that fails in this way.

It is an old confluent Issue (it just can't be runned on macos) and I can't run confluent tests locally as well. But you do not need run them in your case, just add and check AsyncAPI test for confluent

@filip-danieluk
Copy link
Contributor Author

Got it, on another note. It was already pointed out in #1608 that there is this snippet:

  if sasl_mechanism:
      self.config.update(
          {
              "sasl.mechanism": sasl_mechanism,
              "sasl.username": sasl_plain_username,
              "sasl.password": sasl_plain_password,
          }
     )

in client.py that will cause a warning that user and password are not needed while using Oauthbearer. I could work on a fix for this as well if needed.

@Lancetnik
Copy link
Member

Got it, on another note. It was already pointed out in #1608 that there is this snippet:

  if sasl_mechanism:
      self.config.update(
          {
              "sasl.mechanism": sasl_mechanism,
              "sasl.username": sasl_plain_username,
              "sasl.password": sasl_plain_password,
          }
     )

in client.py that will cause a warning that user and password are not needed while using Oauthbearer. I could work on a fix for this as well if needed.

It will be great

@filip-danieluk
Copy link
Contributor Author

Added test where you asked, by accident added one more in tests/brokers/confluent. For that client.py code I did bare minimum to get rid of warning. Is there anything else I should do?

Copy link
Member

@Lancetnik Lancetnik left a comment

Choose a reason for hiding this comment

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

Thank you a lot! But I have to ask you for one more thing. You added doc/docs_src example, but didn't include it to the doc. Can you please use it the documentation (here https://github.com/airtai/faststream/blob/main/docs/docs/en/kafka/security.md) and write a test for it here: https://github.com/airtai/faststream/blob/main/tests/docs/kafka/test_security.py ?

@filip-danieluk
Copy link
Contributor Author

kafka/ or confluent/ ?

@Lancetnik
Copy link
Member

kafka/ or confluent/ ?

Sorry, the confluent one

@filip-danieluk
Copy link
Contributor Author

I have added docs to docs\docs\en\confluent\security.md however I believe that confluent equivalent of the test you mentioned https://github.com/airtai/faststream/blob/main/tests/docs/kafka/test_security.py is actually the test I have already added here tests/brokers/confluent/test_security.py, right?

@Lancetnik
Copy link
Member

I have added docs to docs\docs\en\confluent\security.md however I believe that confluent equivalent of the test you mentioned https://github.com/airtai/faststream/blob/main/tests/docs/kafka/test_security.py is actually the test I have already added here tests/brokers/confluent/test_security.py, right?

tests/docs is more important than regular ones due they covers both faststream/ and docs/ code. They can duplicates each other, but documentation tests are required.

@Lancetnik Lancetnik added enhancement New feature or request Confluent Issues related to `faststream.confluent` module labels Aug 4, 2024
@Lancetnik Lancetnik added this pull request to the merge queue Aug 4, 2024
Merged via the queue into airtai:main with commit 35aac56 Aug 4, 2024
29 checks passed
@Lancetnik
Copy link
Member

@filip-danieluk sorry, but why you set security AsyncAPI as {"type": "oauthBearer"}? - there is no such type in AsyncAPI specification

Снимок экрана 2024-09-20 в 14 17 24

Can I ask you to selected correct type from the supporting ones? We faced with a problem now #1802

@filip-danieluk
Copy link
Contributor Author

Sorry, missed that. I will take a look at that and raise PR this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Confluent Issues related to `faststream.confluent` module enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: add sasl_oauthbearer support
2 participants