Skip to content

Conversation

@aakashnand
Copy link
Member

The recent version of trino has the JWT authentication method so this PR adds support for JWT authentication in trino-python-client. I have updated documentation in README as well for the usage of JWT authentication. Please let me know if any improvement is needed.

@cla-bot
Copy link

cla-bot bot commented Feb 20, 2021

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please submit the signed CLA to cla@trino.io. For more information, see https://github.com/trinodb/cla.

Copy link
Member

@dain dain left a comment

Choose a reason for hiding this comment

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

The authorization header looks correct to me

@findepi findepi requested a review from joshthoward February 23, 2021 17:07
@aakashnand
Copy link
Member Author

@dain @joshthoward thanks for the suggestions. I am waiting for my CLA to be updated otherwise the cla-bot will fail again.

@martint
Copy link
Member

martint commented Feb 26, 2021

@cla-bot check

@cla-bot cla-bot bot added the cla-signed label Feb 26, 2021
@cla-bot
Copy link

cla-bot bot commented Feb 26, 2021

The cla-bot has been summoned, and re-checked this pull request!

@aakashnand
Copy link
Member Author

@joshthoward @dain I have applied the changes as you suggested. Please take a moment to review again.

cc: @findepi

@aakashnand
Copy link
Member Author

I did not use separate commits for the suggestion as I thought it would be unnecessary to add new commits for minor changes. Please let me know if this is the wrong practice so that I can improve in future.

@joshthoward
Copy link
Member

LGTM

@dain
Copy link
Member

dain commented Mar 1, 2021

I don't know much about the python client, but the headers looks correct to me. I would suggest squashing into a single commit.

@dain dain removed their request for review March 1, 2021 17:55
@aakashnand aakashnand requested review from ebyhr and findepi March 2, 2021 00:49
Copy link
Member

@ebyhr ebyhr left a comment

Choose a reason for hiding this comment

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

Left only minor comments. Just curious, did you test this PR with your Trino cluster?

@aakashnand
Copy link
Member Author

@ebyhr Thanks for the detailed review. I will make those changes. I was already using JWT token authentication on my local trino cluster. It is working without any problem. One question though as @dain suggested me to squash commits into one, does it mean that every PR should have single commit only?

@ebyhr
Copy link
Member

ebyhr commented Mar 4, 2021

@aakashnand No, it depends on the situation. We usually don't separate commits for code and docs change, so single commit in this PR is reasonable.

@aakashnand
Copy link
Member Author

@ebyhr Got it. I will make changes soon and will request a final review again from you. Thanks

Comment on lines +165 to +169
def get_exceptions(self):
return ()

def handle_error(self, handle_error):
pass
Copy link
Member

Choose a reason for hiding this comment

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

This is default behavior of Authentication, so seems can be omitted here


from six import with_metaclass
from typing import Any, Optional, Text # NOQA
from requests.auth import AuthBase
Copy link
Member

Choose a reason for hiding this comment

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

That's out of scope of this PR, but we should define an ALL here, so that from trino.auth import * doesn't pull things like AuthBase... or we say we don't care.

@findepi findepi merged commit f638b93 into trinodb:master Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

6 participants