-
Notifications
You must be signed in to change notification settings - Fork 182
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
Issue ref #269: OAuth 2.0 Credential Format for Delta Sharing Python … #309
Issue ref #269: OAuth 2.0 Credential Format for Delta Sharing Python … #309
Conversation
… Python Client Pull Request Signed-off-by: Dima Alberg <[email protected]>
… Python Client Pull Request Signed-off-by: Dima Alberg <[email protected]>
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.
I left some comment in dialberg@33bd3ba. Could you please address them and try to add some basic unit test in this PR?
… Python Client Pull Request Signed-off-by: Dima Alberg <[email protected]>
I have fixed comments and added unit tests. |
python/delta_sharing/rest_client.py
Outdated
if urlparse(profile.endpoint).hostname == "localhost": | ||
self._session.verify = False | ||
|
||
def auth_broker(self, profile): |
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.
Can you make all internal methods private by prepend the _
? e.g. _auth_broker
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.
Fixed.
profile.client_secret),) | ||
bearer_token = "{}".format(response.json()["access_token"]) | ||
|
||
self._session.headers.update( |
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.
The content-type and accept headers are not meant to be sent to the API headers but the token exchange endpoints.
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.
Fixed.
python/delta_sharing/rest_client.py
Outdated
) | ||
|
||
def auth_basic(self, profile): | ||
response = requests.post(profile.endpoint, |
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.
This does not look right: you are making a request to the API endpoint to request a bearer token. Instead, the username and password should be used as the credential to talk to the API endpoint directly.
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.
Fixed.
… Python Client Pull Request Signed-off-by: Dima Alberg <[email protected]>
Thanks for comments. |
… Python Client Pull Request Signed-off-by: Dima Alberg <[email protected]>
Could you please address to my recent fixes? |
… Python Client Pull Request Signed-off-by: Dima Alberg <[email protected]>
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.
LGTM. Did you do any testing on a server that supports oauth2 or basic auth?
Thanks. Sorry, but I don’t have write access to the repository. |
@dialberg I helped merge the PR to the main branch. Thanks a lot for your contribution! |
Thanks a lot! |
Issue ref #269: OAuth 2.0 Credential Format for Delta Sharing Python Client Support