-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
User request
Add OIDC IdP support so different users can sign in and have their own conversations. Without a configured IdP, the system should continue working in single-user mode as it does today.
Specification
Current state (repo findings)
- Backend:
packages/platform-server(NestJS) with Prisma/Postgres (AGENTS_DATABASE_URL). - Conversations are persisted as
Threadrecords in Prisma schema; currently no user ownership fields exist, so all threads are global. UserProfiletable/service is singleton (id=1) and is not a real per-user identity.
Goals
- Support
AUTH_MODE=oidcto enable OIDC sign-in (Authorization Code + PKCE). - Support
AUTH_MODE=single_user(default) to preserve current behavior with a default local user. - Ensure thread/conversation isolation: users can only see/manage their own threads.
Backend work
- Add
AUTH_MODEconfig and OIDC config env vars (OIDC_ISSUER_URL,OIDC_CLIENT_ID,OIDC_CLIENT_SECRETif needed,OIDC_REDIRECT_URI, scopes). - Add Auth module with endpoints:
GET /auth/loginGET /auth/callbackPOST /auth/logoutGET /auth/me
- Add session-based auth (cookie + server-side session store). Session stores principal:
{ mode, userId, issuer, subject }. - Add auth guard that:
- in
single_useralways injects default principal - in
oidcrequires session else 401
- in
Persistence / Prisma
- Add models:
UserAuthIdentitywith unique(provider, issuer, subject)referencingUser
- Add
Thread.ownerUserIdFK toUserplus indexes. - Migration/backfill:
- create default local user with constant UUID
- backfill existing threads to that user
- make
ownerUserIdNOT NULL
Thread API scoping
- Update all thread queries/mutations to filter by
ownerUserId = principal.userId(e.g.,AgentsPersistenceService.listThreads()and any get/update endpoints). - Add tests to prevent regressions (user A cannot access user B threads).
Frontend work
- In OIDC mode, boot via
GET /auth/me; if 401 redirect to/auth/login. - Add sign in/out UI (minimal).
Risks
- Data leakage if any thread query lacks owner scoping: must be addressed systematically + tested.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels