Repository navigation
feat: session-management UI - #3189
Conversation
Implements plan 016 (Option B, hard cutover). Every /token refresh_token call rotates; a new auth_session_tokens table holds one durable row per issued token so replay survives cache flushes and can trigger the RFC 6819 reaction strategy (revoke the whole token family). - schema: auth_session_tokens (session_id FK ON DELETE CASCADE, kind, consumed_at/revoked_at, lineage), widen auth_sessions.ip_address 15 -> 45, mysql + postgres migrations - issuers write a row per access/refresh token when session_id is present - refresh grant is DB-row-authoritative (skipActiveCheck): atomic consume, replay -> soft-revoke family + blocklist jtis + delete session -> invalid_grant; /token/revoke soft-revokes the row too - tokenRefreshGracePeriod (default 0 = strict) scoped to the chain tip - ISessionManager.revoke(); oauth2-cleaner sweeps expired token rows - lower tokenAccessMaxAge default 3600 -> 900 BREAKING CHANGE: all in-flight refresh tokens are invalidated on upgrade (the new table is empty), so active users sign in again once. The default access-token lifetime drops from 3600s to 900s.
Adds a REST surface over auth_sessions so identities can see and revoke
sessions ("active devices" / force logout). Backend + typed client only;
the client-web UI is a follow-up.
- SESSION_READ / SESSION_DELETE permissions (auto-provisioned; admin=any,
realm_admin=ownOrNull read / own delete)
- SessionService + SessionController, dual-mounted /sessions and
/realms/:realmId/sessions:
GET /sessions list (self-scoped without SESSION_READ, else realm-gated)
GET /sessions/:id read one (@me/@self = current session)
DELETE /sessions/:id revoke one (own needs no permission)
DELETE /sessions revoke all own sessions except the current one
- SessionRepository.findMany / findAllByOwner (list bypasses the id-keyed
cache); force-selects realm_id/sub/sub_kind so a client `fields` projection
cannot strip realm_id and neutralize the per-row realm_scope gate
- current session id stashed by the authorization middleware for
delete-all-but-current
- typed client.session API in @authup/core-http-kit
- deleting a session cascade-drops its auth_session_tokens rows, so a force
logout also invalidates the subject's refresh tokens
Self-service is inherent: an identity can always list/revoke its own
sessions (ownership = session.sub + sub_kind == actor identity).
Integrate the merged rotation feature (#3186, squash) + SSR internal-http-client (#3188) from master. Conflict resolutions: - issuers / refresh grant / session-token repository / grant spec: take master's version (inlined row-write + review-fix hardening), dropping the now-removed persistSessionTokenRow helper - architecture.md: keep master's issuer-row wording + this branch's Session Management API section
createFakeUser().password is typed string | null (User.password is nullable, widened by the ...data spread), which failed check:types against createWithPassword's string param. Pass a known password const instead.
Client-web UI for the session-management API (#3187): - EntityType.SESSION + EntityTypeMap entry (core-kit) - ASessions collection component (client-web-kit) - /settings/sessions self page ("my active sessions") + settings nav item - /users/:id/sessions admin tab + user-detail nav item - both list ip_address / user_agent / last-seen / expires with per-session revoke via AEntityDelete (entity-type="session"); the self page scopes to the current user, the admin tab filters by user_id and gates revoke on SESSION_DELETE - i18n: SESSION entity noun + ipAddress/userAgent/seenAt/expiresAt field labels across en/de/fr/es
|
Warning Review limit reached
Next review available in: 20 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (18)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
authup
@authup/client-web
@authup/server-core
@authup/access
@authup/client-web-kit
@authup/client-web-kit-theme
@authup/client-web-nuxt
@authup/client-web-theme
@authup/core-http-kit
@authup/core-kit
@authup/core-realtime-kit
@authup/errors
@authup/i18n
@authup/kit
@authup/server-adapter-kit
@authup/server-adapter-node
@authup/server-adapter-socket-io
@authup/server-adapter-web
@authup/server-kit
@authup/server-test-kit
@authup/specs
commit: |
There was a problem hiding this comment.
Pull request overview
Adds the client-web UI layer for the new session-management surface (Plan 016 PR G2), wiring a session entity into shared entity infrastructure and exposing session lists + revoke actions in both self-service settings and the admin user-detail area.
Changes:
- Introduces
EntityType.SESSION+EntityTypeMapmapping so collection utilities resolveclient.session. - Adds
ASessionscollection component (mirrors existing entity collection components likeAUsers). - Adds
/settings/sessionsand/users/:id/sessionspages with session table columns (IP address, user agent, last seen, expires) and revoke viaAEntityDelete, plus i18n keys for all supported locales (en/de/fr/es).
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/i18n/src/constants.ts | Adds SESSION entity key and new field keys (seenAt, expiresAt, ipAddress, userAgent) for UI labeling. |
| packages/i18n/src/catalogs/en/entity.ts | Adds English pluralization for the session entity noun. |
| packages/i18n/src/catalogs/de/entity.ts | Adds German pluralization for the session entity noun. |
| packages/i18n/src/catalogs/es/entity.ts | Adds Spanish pluralization for the session entity noun. |
| packages/i18n/src/catalogs/fr/entity.ts | Adds French pluralization for the session entity noun. |
| packages/i18n/src/catalogs/en/field.ts | Adds English labels for session table fields. |
| packages/i18n/src/catalogs/de/field.ts | Adds German labels for session table fields. |
| packages/i18n/src/catalogs/es/field.ts | Adds Spanish labels for session table fields. |
| packages/i18n/src/catalogs/fr/field.ts | Adds French labels for session table fields. |
| packages/core-kit/src/domains/contstants.ts | Adds EntityType.SESSION to the shared entity-type enum. |
| packages/core-kit/src/domains/types.ts | Extends EntityTypeMap with Session so generic entity tooling can type-resolve sessions. |
| packages/client-web-kit/src/components/entities/session/index.ts | Adds a barrel export for the new sessions collection component. |
| packages/client-web-kit/src/components/entities/session/ASessions.ts | Implements ASessions as an entity-collection wrapper for sessions with “no more” translation. |
| packages/client-web-kit/src/components/entities/index.ts | Re-exports the new session entity components from the entities module. |
| apps/client-web/pages/settings/index.vue | Adds a “Sessions” item to the settings navigation (translated via entity noun). |
| apps/client-web/pages/settings/index/sessions.vue | Adds self “active sessions” page scoped to current user, with revoke action. |
| apps/client-web/pages/users/[id].vue | Adds “Sessions” tab entry on user detail navigation (translated). |
| apps/client-web/pages/users/[id]/sessions.vue | Adds admin user sessions tab listing sessions filtered by user_id, with revoke gated by SESSION_DELETE. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@coderabbitai review |
✅ Action performedReview finished.
|
Plan 016 PR G2 — the client-web UI for the session-management API. Stacked on #3187 (base is
feat/session-management), so this diff is the UI only; it auto-retargets to master when #3187 merges.What it adds
EntityType.SESSION+EntityTypeMapentry (@authup/core-kit) so the entity-collection manager resolvesclient.session.ASessionscollection component (@authup/client-web-kit), mirroringAUsers./settings/sessions— a self "active sessions" page (+ a Sessions item in the settings nav). Scoped to the current user (an admin holdingSESSION_READwould otherwise see every session; non-admins are self-scoped by the server anyway)./users/:id/sessions— an admin tab on the user-detail page (+ nav item), filtered byuser_id, revoke gated onSESSION_DELETE.<AEntityDelete entity-type="session">→client.session.delete, with the built-in confirm dialog).SESSIONentity noun +ipAddress/userAgent/seenAt/expiresAtfield labels across en/de/fr/es (the locale-parity test enforces completeness).Verification
nuxi typecheck(vue-tsc), so the SFCs are type-checked; passed.Follow-ups (not in this PR)
client.session.deleteMany()(the endpoint exists in feat: session-management API (list + revoke sessions) #3187)./users/:id/sessionstab shows for anyone who can view the user-detail page; aSESSION_READ-less viewer just sees an empty list (server self-scopes) — could gate the nav item on the permission.