Title#
feat(atlassian): add AtlassianOAuthAuthProvider abstract base (BJ-1)
Problem#
The Atlassian integration EPIC (#539) needs a shared OAuth 2.0 authentication foundation before Bitbucket and Jira providers can be implemented. Without it, BJ-2 and BJ-3 have no base class to extend.
Task / Link#
Closes #541 — BJ-1: AtlassianOAuthAuthProvider abstract base EPIC: #539
Changes#
- Add
AtlassianOAuthAuthProviderabstract class implementingPlatformAuthProviderwith OAuth 2.0 refresh-token flow - Add
AtlassianOAuthStateRepointerface +ATLASSIAN_OAUTH_STATE_REPOinjection token (concrete DB impl comes in BJ-5) - Add
AtlassianOAuthConfigandAtlassianPlatformtypes used by BJ-2/BJ-3 subclasses - Add
src/atlassian/index.tsbarrel export - Add unit tests: cached token reuse, preemptive 5-min refresh, concurrent call coalescing, rotated token persistence, error propagation
Notes#
AtlassianOAuthStateRepois interface-only here; BJ-5 delivers the DB-backed implementation- Atlassian rotates the refresh token on every refresh —
saveRefreshTokenis awaited before returning the access token to prevent stale-token crashes
Testing#
- 9 unit tests via a concrete test subclass (
TestAtlassianProvider) - All scenarios from the plan acceptance criteria covered
npm run lint— zero warningsnpm run test -- atlassian-oauth-auth— all 9 pass