chore: Auth plugin and admin guard UUID migration (#206) #212

Closed
opened 2026-02-16 15:01:35 +00:00 by egullickson · 0 comments
Owner

Relates to #206

Milestone 2: Auth plugin and admin guard

Update the auth plugin to use profile.id UUID as userContext.userId instead of raw JWT sub. Update admin guard to query by user_profile_id.

Files

  • backend/src/core/plugins/auth.plugin.ts
  • backend/src/core/plugins/admin-guard.plugin.ts

Key Changes

  • auth.plugin.ts: Rename userId to auth0Sub for JWT sub. After getOrCreate, set userId = profile.id
  • admin-guard.plugin.ts: Query WHERE user_profile_id = $1 instead of WHERE auth0_sub = $1

Acceptance Criteria

  • userContext.userId contains UUID format after authentication
  • Admin guard correctly identifies admin users by UUID
  • Auth0 Management API calls still work (use raw JWT sub)
Relates to #206 ## Milestone 2: Auth plugin and admin guard Update the auth plugin to use profile.id UUID as userContext.userId instead of raw JWT sub. Update admin guard to query by user_profile_id. ### Files - `backend/src/core/plugins/auth.plugin.ts` - `backend/src/core/plugins/admin-guard.plugin.ts` ### Key Changes - auth.plugin.ts: Rename `userId` to `auth0Sub` for JWT sub. After getOrCreate, set `userId = profile.id` - admin-guard.plugin.ts: Query `WHERE user_profile_id = $1` instead of `WHERE auth0_sub = $1` ### Acceptance Criteria - [ ] userContext.userId contains UUID format after authentication - [ ] Admin guard correctly identifies admin users by UUID - [ ] Auth0 Management API calls still work (use raw JWT sub)
egullickson added the
status
backlog
type
chore
labels 2026-02-16 15:02:03 +00:00
egullickson added this to the Sprint 2026-02-02 milestone 2026-02-16 15:02:07 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: egullickson/motovaultpro#212