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

feat: Add OAuth2 authentication support #95

Closed
wants to merge 1 commit into from

Conversation

imprvhub
Copy link

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

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
@pnadolny13
Copy link
Collaborator

@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!

@ReubenFrankel
Copy link
Contributor

Thanks for this. As Pat pointed out in #86 it feels a bit redundant to support access_token given that they are short-lived, but no harm in accepting it - especially now there is full OAuth support and could eventually work with write-back.

password=api_token,
)

class JiraOAuth2Authenticator(APIAuthenticatorBase):
Copy link
Contributor

@ReubenFrankel ReubenFrankel Nov 27, 2024

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

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?

https://github.com/MeltanoLabs/tap-jira/pull/86/files#diff-9a8a5da31511510c569573541d7460963e518208e1f71162cf6847378a12dfb4L33-L48

@edgarrmondragon edgarrmondragon self-assigned this Nov 27, 2024
@imprvhub imprvhub closed this Nov 28, 2024
@imprvhub imprvhub deleted the feature/oauth-support branch November 28, 2024 03:26
@ReubenFrankel
Copy link
Contributor

Did you mean to close this? @imprvhub

@imprvhub
Copy link
Author

@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.

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.

feat: Support OAuth
4 participants