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

Issue ref #269: OAuth 2.0 Credential Format for Delta Sharing Python … #309

Merged
merged 6 commits into from
Jun 5, 2023

Conversation

dialberg
Copy link
Contributor

Issue ref #269: OAuth 2.0 Credential Format for Delta Sharing Python Client Support

dialberg added 2 commits May 15, 2023 20:04
… Python Client Pull Request

Signed-off-by: Dima Alberg <[email protected]>
… Python Client Pull Request

Signed-off-by: Dima Alberg <[email protected]>
Copy link
Collaborator

@zhuansunxt zhuansunxt left a 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]>
@dialberg
Copy link
Contributor Author

I have fixed comments and added unit tests.

if urlparse(profile.endpoint).hostname == "localhost":
self._session.verify = False

def auth_broker(self, profile):
Copy link
Collaborator

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

Copy link
Contributor Author

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(
Copy link
Collaborator

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.

Copy link
Contributor Author

@dialberg dialberg May 24, 2023

Choose a reason for hiding this comment

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

Fixed.

)

def auth_basic(self, profile):
response = requests.post(profile.endpoint,
Copy link
Collaborator

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.

Copy link
Contributor Author

@dialberg dialberg May 24, 2023

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]>
@dialberg
Copy link
Contributor Author

dialberg commented May 24, 2023

Thanks for comments.

… Python Client Pull Request

Signed-off-by: Dima Alberg <[email protected]>
@dialberg
Copy link
Contributor Author

Could you please address to my recent fixes?
Thanks.

… Python Client Pull Request

Signed-off-by: Dima Alberg <[email protected]>
@zhuansunxt zhuansunxt self-requested a review June 2, 2023 22:14
Copy link
Collaborator

@zhuansunxt zhuansunxt left a 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?

@dialberg
Copy link
Contributor Author

dialberg commented Jun 3, 2023

Thanks.
Yes, I have performed testing on our servers.
It worked as expected.

Sorry, but I don’t have write access to the repository.
How we can merge this pull request into the project?
Thanks.

@zhuansunxt zhuansunxt merged commit 60abca1 into delta-io:main Jun 5, 2023
@zhuansunxt
Copy link
Collaborator

@dialberg I helped merge the PR to the main branch. Thanks a lot for your contribution!

@dialberg
Copy link
Contributor Author

dialberg commented Jun 5, 2023

Thanks a lot!

@dialberg dialberg deleted the dialberg_delta_sharing_client_v1 branch June 10, 2023 20:02
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.

2 participants