Skip to content

Add OAuth 2.0 authentication support #365

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

Merged
merged 3 commits into from
May 5, 2025

Conversation

zparnold
Copy link
Contributor

@zparnold zparnold commented May 2, 2025

Description

This PR adds OAuth 2.0 authentication support for Atlassian Cloud services (Jira and Confluence). This implementation allows users to authenticate using the modern OAuth 2.0 flow with Atlassian Cloud, which is more secure and flexible than API tokens, especially for integrations with third-party applications.

Fixes: #238

Changes

  • Added OAuth 2.0 configuration and token management in utils/oauth.py
  • Implemented an OAuth authorization helper script (scripts/oauth_authorize.py)
  • Updated Jira and Confluence clients to support OAuth authentication
  • Added environment variable support for OAuth configuration
  • Updated documentation with OAuth setup instructions
  • Added comprehensive test coverage for OAuth functionality

Testing

  • Unit tests added/updated
    • Added test_client_oauth.py for both Jira and Confluence
    • Added test_oauth.py for OAuth utility functions
  • Manual checks performed: [Tested full OAuth flow with Atlassian Cloud, verified token refresh, and API access] Will complete this once I have a tenant to test with

Checklist

  • Code follows project style guidelines (linting passes).
  • Tests added/updated for changes.
  • All tests pass locally.
  • Documentation updated (if needed).

Copy link
Owner

@sooperset sooperset left a comment

Choose a reason for hiding this comment

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

@zparnold Thank you for this PR adding OAuth 2.0 authentication support! This addresses issue #238 and provides a more secure and flexible authentication option for Atlassian Cloud users.

I'm impressed with your implementation structure. You've done an excellent job separating the complex OAuth flow into a dedicated helper script and encapsulating core OAuth logic in the appropriate modules.

I have a suggestion regarding token storage that might enhance security. Currently, the implementation stores tokens in JSON files, but have you considered using the keyring library? It would store credentials in the OS's native secure storage (like macOS Keychain or Windows Credential Manager) which could provide better protection for sensitive tokens.

@zparnold
Copy link
Contributor Author

zparnold commented May 5, 2025

Thank you for your valuable feedback! I've implemented the suggested changes:

  1. Secure Token Storage with Keyring:

    • Added keyring integration to store OAuth tokens in the operating system's native secure credential storage (macOS Keychain, Windows Credential Manager, or Linux Secret Service)
    • Implemented fallback to file-based storage if keyring is not available
    • All related tests are now passing
  2. Improved User Experience with Built-in OAuth Setup Wizard:

    • Added a convenient --oauth-setup command-line flag to the main CLI
    • Created an interactive setup wizard that guides users through the OAuth configuration process
    • Users can now easily set up OAuth authentication by running mcp-atlassian --oauth-setup
  3. Fixed CI Test Issue:

    • Updated the test_init_with_basic_auth test to correctly expect the verify_ssl parameter

The implementation provides a secure and user-friendly way for users to authenticate with Atlassian Cloud services using OAuth 2.0. The tokens are now stored securely by default, with a fallback mechanism for environments where keyring is not available.

@sooperset sooperset self-requested a review May 5, 2025 04:47
Copy link
Owner

@sooperset sooperset left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for implementing these changes and for your great contribution!

@sooperset sooperset merged commit 0d30b9f into sooperset:main May 5, 2025
5 checks passed
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.

[Feature Request] Support for OAuth 1.0 authentication in addition to access token for Jira integration
2 participants