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

Add support for JWT authentication #948

Merged
merged 3 commits into from Oct 31, 2018

Conversation

ardakuyumcu
Copy link
Contributor

APIs such as https://developer.github.com/v3/apps/#find-organization-installation use a JWT for authentication. Adding support for JWT auth.

@@ -241,6 +243,7 @@ def setUp(self):
self.oauth_token = "oauth_token"
self.client_id = "client_id"
self.client_secret = "client_secret"
self.jwt = "jwt"
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't you add a activateJwtAuthMode in this file as well? Since this PR adds support for authenticating with JWT, we should support recording tests through it right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sfdye thanks for the suggestion, I added the mode and verified that it works.

@sfdye
Copy link
Member

sfdye commented Oct 26, 2018

@ardakuyumcu Awesome addition you've got here. Did you test this change with an actual Github app? I will review the other two PRs once we close this one 👍

@ardakuyumcu
Copy link
Contributor Author

@sfdye yes, I tested the JWT mode with the API I added in #949 which actually uses a Bearer JWT token for auth.

self._initializeDebugFeature()

if password is not None:
if jwt is not None:
Copy link
Member

Choose a reason for hiding this comment

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

Would you mind moving this case after the login_or_token?

@@ -44,6 +44,10 @@ def main(argv):
github.tests.Framework.activateTokenAuthMode()
argv = [arg for arg in argv if arg != "--auth_with_token"]

if "--auth_with_jwt" in argv:
Copy link
Member

Choose a reason for hiding this comment

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

One final touch, this could be documented here in the contribution guide:
https://github.com/PyGithub/PyGithub/blob/master/CONTRIBUTING.md#automated-tests

@ardakuyumcu
Copy link
Contributor Author

@sfdye added the requested changes

@sfdye sfdye merged commit 8ccf9a9 into PyGithub:master Oct 31, 2018
@sfdye
Copy link
Member

sfdye commented Oct 31, 2018

@ardakuyumcu Awesome, thank you very much!

@blast-hardcheese
Copy link

This option breaks positional argument compatibility 😞

candrikos pushed a commit to candrikos/PyGithub that referenced this pull request Sep 25, 2020
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.

None yet

3 participants