Skip to content

feat: add OAuth2 diode:ingest scope to authentication process #43

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

Merged
merged 4 commits into from
Apr 23, 2025

Conversation

mfiedorowicz
Copy link
Member

This pull request introduces support for OAuth2 scopes in the DiodeClient authentication flow, specifically adding the diode:ingest scope for ingestion operations. The changes include updates to the client code to handle scopes and modifications to the test suite to validate the new functionality.

Authentication Enhancements:

  • Added a new constant _OAUTH2_INGEST_SCOPE for the diode:ingest scope in netboxlabs/diode/sdk/client.py. This scope is now passed during authentication for ingestion operations. [1] [2]
  • Updated the _authenticate method to accept a scope parameter and pass it to the _DiodeAuthentication class.
  • Modified the _DiodeAuthentication class to include a scope attribute and ensure the scope is sent in the OAuth2 token request. [1] [2]

Test Updates:

  • Updated multiple test cases in tests/test_client.py to include the scope="diode:ingest" parameter when initializing _DiodeAuthentication. This ensures the new scope functionality is properly tested. [1] [2] [3] [4]

@mfiedorowicz mfiedorowicz self-assigned this Apr 22, 2025
@mfiedorowicz mfiedorowicz changed the title feat: add OAuth2 ingest scope to authentication process feat: add OAuth2 diode:ingest scope to authentication process Apr 22, 2025
Copy link

github-actions bot commented Apr 22, 2025

Coverage

Coverage Report
FileStmtsMissCoverMissing
/opt/hostedtoolcache/Python/3.10.17/x64/lib/python3.10/site-packages/netboxlabs/diode/sdk
   client.py190498%81, 256, 310, 338
TOTAL222498% 

Tests Skipped Failures Errors Time
93 0 💤 0 ❌ 0 🔥 0.991s ⏱️

Copy link

Coverage

Coverage Report
FileStmtsMissCoverMissing
/opt/hostedtoolcache/Python/3.10.17/x64/lib/python3.10/site-packages/netboxlabs/diode/sdk
   client.py191498%76, 241, 277, 305
TOTAL223498% 

Tests Skipped Failures Errors Time
93 0 💤 0 ❌ 0 🔥 0.909s ⏱️

Copy link
Contributor

@ltucker ltucker left a comment

Choose a reason for hiding this comment

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

linter has notes on here, but otherwise fine

@mfiedorowicz mfiedorowicz merged commit 5390507 into update_datamodel Apr 23, 2025
3 checks passed
@mfiedorowicz mfiedorowicz deleted the feat-oauth2-scope branch April 23, 2025 04:59
Copy link

🎉 This PR is included in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

2 participants