-
Notifications
You must be signed in to change notification settings - Fork 14
Credential Providers Refactoring #60
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a breaking change, can the fact that it is be called out more? Whether in the docs or when trying to import BasicAuthProvider. Right now if someone were using the old class they'd only get an error like...
ImportError: cannot import name 'BasicAuthProvider' from 'jamf_pro_sdk.clients.auth'
When we cut a new release we'll include it there for sure as well. Most of my comments are around clarity and improving the docs, especially for newcomers. I tested the changes and everything works as expected. Nice work here. Let me know your thoughts on defaulting to ApiClientCredentialsProvider and if you have any questions.
|
All great callouts, I will definitely get these implemented.
We are 100% aligned here. I also see basic auth as legacy. I'll be sure to sprinkle in some warning admonitions throughout that recommend using Any preference on how the breaking changes are called out in the docs? I'm personally partial to Sphinx admonitions for describing changes between versions, but am open to alternate approaches. |
…admonitions of breaking changes
|
Got those changes implemented, let me know if there's anything I missed! |
|
Wow, this is great work @liquidz00! I will test these changes as well. |
|
@jp-cpe thank you! |
|
FYI: I added some logic to from src.jamf_pro_sdk import (
JamfProClient,
ApiClientCredentialsProvider,
UserCredentialsProvider,
load_from_keychain,
)
user_client = JamfProClient(
server="anyorg.jamfcloud.com",
credentials=load_from_keychain(UserCredentialsProvider, "anyorg.jamfcloud.com"),
)
print(user_client)
api_client = JamfProClient(
server="anyorg.jamfcloud.com",
credentials=load_from_keychain(ApiClientCredentialsProvider, "anyorg.jamfcloud.com"),
)
print(api_client)I tested both scenarios--omitting the scheme entirely and only passing |
…rovider utility functions
…lution Refactored load_from_keychain to accept `client_id` or `username` as keyword arguments instead of prompting the user directly. Improves automation and unifies behavior across credential provider types.
Credential Providers Refactoring
Overview
This PR implements the following:
BasicAuthCredentialProvidertoUserCredentialsProviderthroughout codebaseLoadFromAWSSecretsManager,PromptForCredentialsandLoadFromKeychaininto helper functions instead of classes. Each function returns aCredentialProvidertype that is specified or raises aTypeErrorif an invalid credential provider was passed.Closes #47
Secondary
The integration unit test steps have been commented out in the runner (
.github/workflows/main_pr_tests.yaml) for now after discussing with Bryson.