feat: add authenticated session handling for admin actions#53
Open
Anichris-koded wants to merge 2 commits into
Open
feat: add authenticated session handling for admin actions#53Anichris-koded wants to merge 2 commits into
Anichris-koded wants to merge 2 commits into
Conversation
…e-guild#37) - Add AdminSessionStatus type (disconnected/connected/authenticating/authenticated/expired) - Expose sessionStatus and markExpired() from SiweAuthContext - AdminGuard branches on sessionStatus; new ExpiredSessionPrompt for expired state - ConnectButton shows session-expired badge with re-authenticate action - Admin mutation onError handlers call markExpired() on 401 - Export AuthError alias from lib/api/live.ts - Mock API: NEXT_PUBLIC_MOCK_SESSION_STATE=expired|unauthenticated for local simulation - Fix pre-existing missing cn import in components/ui/api-states.tsx - Fix duplicate imports and broken FeatureGate nesting in policies page - Add docs/admin-session-contract.md with backend endpoint contract
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements issue #37 — adds a clear authenticated-session boundary for admin actions.
Changes
AdminSessionStatustype — newdisconnected | connected | authenticating | authenticated | expiredunion inlib/api/types.tsSiweAuthContext— exposessessionStatusandmarkExpired(); derived from local state, no extra API callsAdminGuard— branches onsessionStatus; newExpiredSessionPromptfor theexpiredstateConnectButton— yellow "Session Expired" badge + "Re-authenticate" whensessionStatus === 'expired'markExpired()on 401, rolling back optimistically and surfacing the inline re-auth bannerAuthErrorexport — re-exported fromlib/api/live.tsas alias ofApiErrorNEXT_PUBLIC_MOCK_SESSION_STATE=expired|unauthenticatedfor local testing without a backenddocs/admin-session-contract.mdwith backend endpoint contract, field shapes, and local dev flagscnimport inapi-states.tsx; duplicate imports and brokenFeatureGatein policies pageTested
npm run typecheckexits 0Acceptance criteria
Closes #37