-
Notifications
You must be signed in to change notification settings - Fork 18
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
feat: Add OAuth2 authentication support #95
Conversation
This commit introduces support for OAuth2 authentication in the tap-jira Singer tap. Key changes include: - Added a new `JiraOAuth2Authenticator` class in `authenticators.py` to handle the OAuth2 authentication flow. This class manages access tokens, refresh tokens, and token expiration. - Updated the `JiraStream` class in `client.py` to use a new `JiraAuthenticator` factory class. This allows the tap to seamlessly switch between basic and OAuth2 authentication based on the provided configuration. - Added new OAuth2 related configuration options to the `TapJira` class in `tap.py`, including `client_id`, `client_secret`, `access_token`, and `refresh_token`. The `config_jsonschema` was updated to reflect these new optional properties and the new `auth_type` property. - Added new unit tests in `tests/test_authenticators.py` to verify the behavior of the new `JiraOAuth2Authenticator` class, including testing token refresh and error handling. - Updated the existing unit tests in `tests/test_core.py` to accommodate the new authentication options and to ensure the tap's core functionality remains intact. This addition provides users with a more secure and flexible authentication option when using the tap-jira. OAuth2 authentication is widely used and recommended by the Jira API for server-to-server integrations. The new code follows the existing design patterns and best practices used throughout the tap. Exception handling and error messages have been included to provide clear feedback in case of authentication issues. Closes #94
@imprvhub thanks for the contribution! I added myself and Edgar as reviewers. @ReubenFrankel I cant technically add you as a reviewer but I wanted to ping you on this since you were asking about it in #86 (comment). Feel free to leave comments and thoughts! |
Thanks for this. As Pat pointed out in #86 it feels a bit redundant to support |
password=api_token, | ||
) | ||
|
||
class JiraOAuth2Authenticator(APIAuthenticatorBase): |
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.
Isn't most of this redundant if the class extended singer_sdk.authenticators.OAuthAuthenticator
(or instantiated directly in create_for_stream
)?
@@ -15,33 +16,70 @@ class TapJira(Tap): | |||
|
|||
config_jsonschema = th.PropertiesList( |
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.
Do we want to represent the desired auth flow using singer_sdk.typing.DiscriminatedUnion
as it was previously?
Did you mean to close this? @imprvhub |
@ReubenFrankel Yes, I intentionally closed this PR. After reviewing the complete interaction history from #94 to here, I realized this might not be the right time or context for my contribution. While I appreciate the technical feedback provided, certain aspects of the collaboration process made me reconsider my participation in this project. I wish you success with the OAuth2 implementation. |
This commit introduces support for OAuth2 authentication in the tap-jira Singer tap.
Key changes include:
Added a new
JiraOAuth2Authenticator
class inauthenticators.py
to handle the OAuth2authentication flow. This class manages access tokens, refresh tokens, and token expiration.
Updated the
JiraStream
class inclient.py
to use a newJiraAuthenticator
factory class.This allows the tap to seamlessly switch between basic and OAuth2 authentication based on the
provided configuration.
Added new OAuth2 related configuration options to the
TapJira
class intap.py
, includingclient_id
,client_secret
,access_token
, andrefresh_token
. Theconfig_jsonschema
wasupdated to reflect these new optional properties and the new
auth_type
property.Added new unit tests in
tests/test_authenticators.py
to verify the behavior of the newJiraOAuth2Authenticator
class, including testing token refresh and error handling.Updated the existing unit tests in
tests/test_core.py
to accommodate the new authenticationoptions and to ensure the tap's core functionality remains intact.
This addition provides users with a more secure and flexible authentication option when using
the tap-jira. OAuth2 authentication is widely used and recommended by the Jira API for
server-to-server integrations.
The new code follows the existing design patterns and best practices used throughout the tap.
Exception handling and error messages have been included to provide clear feedback in case of
authentication issues.
Closes #94