Repository navigation
feat(cms): sign in to the Payload admin with a Lumen account (PX1) - #22
Merged
Merged
Conversation
The admin no longer has passwords of its own. /admin shows a Lumen sign-in (emailed code, GitHub, Google); the session goes into an HttpOnly cookie on the CMS host, and a `lumen` auth strategy resolves it through api-edge over the LUMEN_API service binding and maps the Lumen user to a `users` row. - users: local strategy off (its columns stay), `lumenUserId` (unique, set by no request), `role` optional with no default: no role means pending - the first admin still needs the owner's setup token; admins grant the rest - the pending page replaces Payload's unauthorized view; sign-out revokes the Lumen session - a request naming another origin gets no user, so no other page (a sibling Worker on the same workers.dev site included) can write with the cookie - migration 206_cms_lumen_identity, converted from Payload's; the converter now accepts column default and nullability changes as idempotent - api-edge CORS and identity-worker's OAuth return allowlist gain the CMS origin of each environment - docs: runbook, architecture, overview, operations guide; epic status Orun-Task: PX-2 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013JuHbkZCjDrGgHdzCrCRqG
ruehowl
marked this pull request as ready for review
October 28, 2026 12:51
ruehowl
added a commit
to sourceplane/multi-tenant-saas-2
that referenced
this pull request
Oct 28, 2026
Staff accounts (admin, editor, instructor) no longer have Payload passwords. /admin shows a Lumen sign-in (emailed code, GitHub, Google); the session goes into an HttpOnly cookie on the CMS host, and a `lumen` auth strategy on `users` resolves it through api-edge over the LUMEN_API service binding and maps the Lumen user to a `users` row. Learners are a separate collection and keep their own accounts and the academy's /login and /register. Ported from sourceplane/lumen-payload#22 (PX1) with the LMS's differences (multi-tenant-saas-2-console design §2-§6). - users: local strategy off (its columns stay), `lumenUserId` (unique, set by no request), `role` optional with no default: no role means pending; the instructor role and its academies stay, and admin access still admits all three staff roles - the first admin still needs the owner's setup token; admins grant the rest, and inviting by email links the row on that person's first sign-in - the pending page replaces Payload's unauthorized view; sign-out revokes the Lumen session - a request naming another origin gets no staff user, so no other page (a sibling Worker on the same workers.dev site included) can write with the cookie - migration 320_cms_lumen_identity, converted from Payload's; the converter accepts column default and nullability changes as idempotent - the Lumen routes live in a (site) group with its own minimal layout; the academy keeps / - api-edge CORS and identity-worker's OAuth return allowlist gain the CMS origin of each environment - docs: runbook, architecture, overview, operations guide; epic status Orun-Task: LX-2 Claude-Session: https://claude.ai/code/session_013JuHbkZCjDrGgHdzCrCRqG Co-authored-by: Claude <noreply@anthropic.com>
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.
PX1 of
specs/epics/lumen-payload-console: the Payload admin's only sign-in is a Lumen account. It has no CMS passwords.What changes
/adminshows a Lumen sign-in: an emailed code, or GitHub or Google where identity has them. The browser calls api-edge's auth routes. The session it gets back is posted to/auth/lumen/session(same origin only), which stores it in an HttpOnly,SameSite=Laxcookie on the CMS host. Page scripts never see it again.lumenauth strategy (apps/cms/src/lib/lumen/). It resolves the cookie withGET /v1/auth/sessionover a newLUMEN_APIservice binding to api-edge, caching each answer 30 s per token hash (failures are not cached). It then finds, links (by email) or creates theusersrow bylumenUserId. The token is never put onreq.user.unauthorizedview, replaced) until an admin grantseditororadmin. The first admin still needs the owner'sCMS_SETUP_TOKEN:/setup?token=…now sends the owner to the sign-in, and whoever signs in with that cookie while no admin exists becomes admin.Originnames another host gets no user. No other page can write through Payload's API with the cookie, including sibling Workers on the sameworkers.devsite, which SameSite does not separate. This replaces Payload'scsrfallowlist, which only guards Payload's own cookie (off now). It is recorded as a departure in the epic's status file.206_cms_lumen_identity:roleloses its default and NOT NULL, andusersgainslumen_user_idwith a unique index. It is converted from Payload's migration. The converter now treatsALTER COLUMN … DROP DEFAULT / DROP NOT NULL / SET …as idempotent; 200 and 205 still convert byte for byte.OAUTH_ALLOWED_CONSOLE_ORIGINSgains the CMS for the OAuth return.cmsnowdependsOnapi-edge.ai/context/operations.md, cms-tests docs, epic status.Verification
tests/cms107 tests (new:users,lumen-strategy,lumen-accounts,lumen-session,lumen-cookies), typecheck and lint clean.tests/db597, including the 206 suite.tests/identity-worker180, including the newoauth-allowlist.tests/api-edgeCORS 42.lumen_user_idsits in the column order./api/users/me;loginandfirst-registeranswer 403.After merge I'll check stage against the task's done-when (pending page, setup → admin, second account pending until promoted, sign-out revokes) and that prod's
/adminshows the sign-in (read-only).Orun-Task: PX-2
Generated by Claude Code