Skip to content

feat: add Atlassian Cloud API token authentication - #17

Merged
takeoverjp merged 1 commit into
Toyota:mainfrom
karangehlod:feat/cloud-basic-auth
Aug 19, 2026
Merged

feat: add Atlassian Cloud API token authentication#17
takeoverjp merged 1 commit into
Toyota:mainfrom
karangehlod:feat/cloud-basic-auth

Conversation

@karangehlod

Copy link
Copy Markdown
Contributor

Summary

Adds support for Atlassian Cloud API token authentication (HTTP Basic auth)
alongside existing PAT-based Bearer auth. Cloud users can now authenticate
using their email and API token instead of requiring a Personal Access Token.

Changes

  • New env vars: CONFLUENCE2MD_USERNAME and CONFLUENCE2MD_API_TOKEN
  • Auth priority: PAT (Bearer) takes precedence over Cloud credentials (Basic)
  • Inline RFC 4648 Base64 encoder (no new dependencies)
  • resolve_auth() replaces get_required_env() with clear error messages
  • Fix: preserve /wiki context path in Cloud URLs (required for Cloud API calls)
  • Updated CLI --help text documenting all auth options
  • Comprehensive unit tests (24 new tests for auth + base64 + headers)

Testing

  • mise run ci passes (fmt, clippy, build, 163 tests, machete)
  • Tested against live Confluence Cloud instance with email + API token

No new dependencies

Base64 encoding implemented inline per project policy.

- Remove EnvConfig struct and replace with resolve_auth() function that intelligently handles multiple auth methods
- Implement priority-based authentication: Personal Access Token (Bearer) takes precedence over Cloud credentials (Basic)
- Add resolve_auth() with comprehensive validation that checks for empty and whitespace-only values
- Implement RFC 4648 standard Base64 encoding as base64_encode() helper function
- Update auth_headers() and binary_auth_headers() to accept pre-formatted Authorization header values
- Add 12 comprehensive unit tests covering Base64 encoding edge cases, RFC 4648 test vectors, and authentication scenarios
- Improve error messages to specifically identify which authentication variable is missing or misconfigured
- Update main.rs to call resolve_auth() and pass Authorization header value to HTTP functions

@takeoverjp takeoverjp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@karangehlod
Thank you very much for your contribution! 🎉
LGTM 👍

I cannot confirm Atlassian Cloud API token authentication, due to lack of environment, but trust you!
Thanks!

@takeoverjp
takeoverjp merged commit 43840b7 into Toyota:main Aug 19, 2026
1 check 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.

2 participants