feat!: local accounts and OpenID Connect sign-in, without Supabase (multi-tenant foundation, part 2) #13
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/12-local-accounts"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #12
What
Accounts and sessions now live in the instance database, through
@quatrain/auth-local. Supabase Auth is removed.POST /api/auth/password-login): opaque session token in the HTTP-only cookiestudio-session, only its digest is stored. Refused after 5 failures in 15 minutes on a login./api/auth/login,/api/auth/callback), through@quatrain/auth-oidc-client: authorization code flow with PKCE, state and nonce kept in a short-lived cookie limited to/api/auth. The first sign-in of an identity opens an account without role; an identity is never matched to an existing account by e-mail address.yarn admin account:create|list|password|roles|disable|enable|delete; tenant members are named by login.0002_local_accounts.sql: the account tables. The application role may read, create and update accounts, never delete them.account:roles) and from tenant memberships, never from a provider claim.src/lib/auth-claims.tsis removed.docs/ACCOUNTS.mdanddocs/ACCOUNTS.fr.md; README,AGENTS.md,.env.distand the multi-tenancy docs updated.Breaking changes
PUBLIC_SUPABASE_URL,PUBLIC_SUPABASE_ANON_KEY,SUPABASE_URL,OAUTH_CLIENT_IDandOAUTH_CLIENT_SECRETare no longer read.yarn admin migrate, then create accounts withyarn admin account:create.OIDC_ISSUER,PUBLIC_BASE_URLis required: the return address is no longer derived from the request.company_id,company_name) are gone; tenants replace them.Other change
astro.config.mjsbundlesjosewith the server: bundled as a CommonJS dependency of a bundled package, it was otherwise imported as a default export and the server did not start.Tests
58 unit tests (17 new: settings, cookies, request user, throttle, grants, and the migration checked against the DDL of the package).
Run by hand on the production build, against PostgreSQL 17 and a stand-in OpenID Connect provider: password sign-in, instance and tenant roles, refusal of another tenant (404), bearer token, sign-out (the old token is refused), throttling, full OpenID Connect flow, one account for repeated sign-ins of an identity, forged callback refused, disabled account refused.
Not included
🤖 Generated with Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.