Skip to content

feat(auth): require a valid edx JWT in hasNonExpiredAuthToken - #171

Open
sonegillis1 wants to merge 1 commit into
mainfrom
feat/edx-token-expiry-check
Open

feat(auth): require a valid edx JWT in hasNonExpiredAuthToken#171
sonegillis1 wants to merge 1 commit into
mainfrom
feat/edx-token-expiry-check

Conversation

@sonegillis1

Copy link
Copy Markdown
Contributor

What

hasNonExpiredAuthToken now requires a valid edx JWT (edx_jwt_token) in addition to the axd token. SSO login stores the edx JWT alongside the axd token, and a valid session needs both present and unexpired.

  • Adds isJwtExpired(token) — reads the JWT exp claim; treats undecodable tokens as expired and tokens without exp as non-expiring.
  • Gates hasNonExpiredAuthToken on the edx token (missing or expired ⇒ re-auth) before the existing axd checks.
  • Updates the existing tests to seed a valid edx token and adds coverage for the new edx-token gate and isJwtExpired (helpers.ts ≥95% line coverage).

🤖 Generated with Claude Code

SSO login stores the edx JWT (edx_jwt_token) alongside the axd token; a
valid session needs both present and unexpired. Add an isJwtExpired helper
that reads the JWT `exp` claim (treating undecodable tokens as expired and
tokens without `exp` as non-expiring) and gate hasNonExpiredAuthToken on the
edx token before the existing axd checks, so re-auth is triggered when the
edx JWT is missing or expired.

Update the hasNonExpiredAuthToken tests to seed a valid edx token and add
coverage for the new edx-token gate and isJwtExpired.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sonegillis1
sonegillis1 requested a review from mamigot as a code owner July 20, 2026 18:17
@mamigot

mamigot commented Jul 20, 2026

Copy link
Copy Markdown
Member

Claude finished @sonegillis1's task —— View job


E2E Coverage Bot

  • Dismiss stale REQUEST_CHANGES reviews (none found)
  • Identify changed files — only utils/helpers.ts and utils/__tests__/helpers.test.ts (no new page.tsx routes)
  • Run mechanical coverage check — no new routes, coverage intact
  • Apply decision logic: CASE E — no new app routes

✅ E2E Coverage — No Issues

No new app routes (page.tsx) were introduced by this PR. The changes are confined to utility helpers and their tests. All existing coverage is intact.

ℹ️ Note: Unable to post a formal GitHub review (requires additional permissions). Coverage determination: approved — no e2e coverage update required.

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