@softure-ai/auth 0.2.6 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/CHANGELOG.md +40 -2
  2. package/README.md +33 -8
  3. package/dist/contract.d.ts +6 -0
  4. package/dist/contract.d.ts.map +1 -1
  5. package/dist/contract.js.map +1 -1
  6. package/dist/index.d.ts +2 -1
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +3 -2
  9. package/dist/index.js.map +1 -1
  10. package/dist/messages/index.d.ts +20 -2
  11. package/dist/messages/index.d.ts.map +1 -1
  12. package/dist/messages/index.js +13 -3
  13. package/dist/messages/index.js.map +1 -1
  14. package/dist/schema.d.ts +88 -0
  15. package/dist/schema.d.ts.map +1 -1
  16. package/dist/schema.js +5 -1
  17. package/dist/schema.js.map +1 -1
  18. package/dist/server/login.js +1 -1
  19. package/dist/server/login.js.map +1 -1
  20. package/dist/server/oidc/accounts.d.ts +2 -0
  21. package/dist/server/oidc/accounts.d.ts.map +1 -1
  22. package/dist/server/oidc/accounts.js +18 -10
  23. package/dist/server/oidc/accounts.js.map +1 -1
  24. package/dist/server/oidc/flow.js +2 -2
  25. package/dist/server/oidc/flow.js.map +1 -1
  26. package/dist/server/oidc/id-token.d.ts +9 -0
  27. package/dist/server/oidc/id-token.d.ts.map +1 -1
  28. package/dist/server/oidc/id-token.js +17 -0
  29. package/dist/server/oidc/id-token.js.map +1 -1
  30. package/dist/server/password-reset.d.ts.map +1 -1
  31. package/dist/server/password-reset.js +4 -5
  32. package/dist/server/password-reset.js.map +1 -1
  33. package/dist/server/privacy.d.ts +2 -0
  34. package/dist/server/privacy.d.ts.map +1 -1
  35. package/dist/server/privacy.js +2 -2
  36. package/dist/server/privacy.js.map +1 -1
  37. package/dist/server/register.js +1 -1
  38. package/dist/server/register.js.map +1 -1
  39. package/dist/server/sessions.js +2 -2
  40. package/dist/server/sessions.js.map +1 -1
  41. package/dist/testing/account.js +1 -1
  42. package/dist/testing/account.js.map +1 -1
  43. package/dist/testing/oidc-provider.d.ts +4 -0
  44. package/dist/testing/oidc-provider.d.ts.map +1 -1
  45. package/dist/testing/oidc-provider.js +4 -0
  46. package/dist/testing/oidc-provider.js.map +1 -1
  47. package/dist/ui/oidc-sign-in.d.ts +1 -1
  48. package/dist/ui/oidc-sign-in.d.ts.map +1 -1
  49. package/dist/ui/oidc-sign-in.js +3 -1
  50. package/dist/ui/oidc-sign-in.js.map +1 -1
  51. package/migrations/0006_add_users_display_name.sql +8 -0
  52. package/module.json +1 -1
  53. package/package.json +1 -1
  54. package/src/contract.ts +6 -0
  55. package/src/index.ts +3 -2
  56. package/src/messages/index.ts +29 -4
  57. package/src/schema.ts +6 -1
  58. package/src/server/login.ts +1 -1
  59. package/src/server/oidc/accounts.ts +20 -10
  60. package/src/server/oidc/flow.ts +2 -2
  61. package/src/server/oidc/id-token.ts +19 -0
  62. package/src/server/password-reset.ts +4 -5
  63. package/src/server/privacy.ts +4 -2
  64. package/src/server/register.ts +1 -1
  65. package/src/server/sessions.ts +2 -2
  66. package/src/testing/account.ts +1 -1
  67. package/src/testing/oidc-provider.ts +6 -0
  68. package/src/ui/oidc-sign-in.tsx +4 -3
package/CHANGELOG.md CHANGED
@@ -4,10 +4,48 @@ Newest first. Each version lists what changed for an app that uses `@softure-ai/
4
4
  production, the version gets a line `verified in: <app>@<commit>` ([docs/05](../../docs/05-adoption-playbook.md),
5
5
  "Definition of done"). Versions before the first one below are described in their GitHub Releases (`auth@x.y.z`).
6
6
 
7
+ ## 0.2.8
8
+
9
+ - OpenID Connect stays opt-in, now stated and tested (#786). An app without `oidc.providers` runs none of it. On a bump
10
+ past 0.2.5 such an app still gets two empty tables (`auth.identities`, `auth.oidc_states`, migration `0005`): a
11
+ module's migrations are one numbered sequence and cannot depend on its options, and without a provider nothing
12
+ writes to them. The `oidc-start` and `oidc-callback` buckets are required only with a provider; spreading
13
+ `AUTH_RATE_LIMIT_BUCKETS` adds their definitions, which count nothing. A new test pins it: without a provider and
14
+ without those buckets, registration and login work and no OpenID Connect row is written. README section 3,
15
+ "Without a provider", lists it all.
16
+ - The 0.2.6 entry below is corrected: it called the release additive without naming migration `0005` or the copy
17
+ keys that 0.2.6 required (optional since 0.2.7).
18
+
19
+ Steps for an app without a provider, from any version up to 0.2.5 to this one: run `softure migrate` (migrations
20
+ `0005` and `0006`). Nothing else: no copy, buckets, environment variables or routes to add.
21
+
22
+ ## 0.2.7
23
+
24
+ - `AuthMessages`: the OpenID Connect keys (`oidc`, `errors.auth.oidc_failed`, `oidc_cancelled`, `oidc_not_allowed`,
25
+ `oidc_no_account`) are optional (#786). In 0.2.6 they were required, so an app with its own dictionary typed
26
+ `AuthMessages` stopped compiling, although that release was described as additive. A missing key reads the English
27
+ copy: `OidcSignIn` falls back to `authMessages.en.oidc`, and `getAuthErrorMessage` to the English message of a known
28
+ code before the dictionary's generic failure. No change for an app.
29
+ - `AuthUser.displayName` (`string | null`): the name an OpenID Connect provider sends (`name`, else `given_name`),
30
+ stored on the account at every sign-in that carries one and kept when a sign-in carries none (#802). Null for a
31
+ password account. Normalized (control characters dropped, whitespace collapsed, trimmed, at most 200 characters); a
32
+ malformed claim is ignored. The property is optional in the type, so an app's own `AuthUser` literals keep
33
+ compiling; the package always sets it.
34
+ - New column `auth.users.display_name` (migration `0006`, nullable, no rewrite). The privacy export lists
35
+ `account.displayName`; the deletion removes it with the account.
36
+ - The OpenID Connect flow always requests the `profile` scope with `openid email`, so Google sends the name. Google
37
+ shows it as part of the basic sign-in consent.
38
+ - `createFakeOidcProvider`: `FakeOidcUser` gains `name` and `givenName`.
39
+
40
+ Migration for an app: run `softure migrate` (migration `0006`). To show the signed-in user by name, read
41
+ `user.displayName ?? user.email`. Users who signed in before the release get their name at their next sign-in.
42
+
7
43
  ## 0.2.6
8
44
 
9
- Sign in with an OpenID Connect provider (Google), limited to allowed domains or emails (#769). Additive: an app without
10
- `oidc` sees no change except two new bucket defaults.
45
+ Sign in with an OpenID Connect provider (Google), limited to allowed domains or emails (#769). Opt-in, but not
46
+ additive for every app: an app without `oidc` runs migration `0005` (two tables it leaves empty), and an app with its
47
+ own dictionary typed `AuthMessages` must add the OpenID Connect copy keys (optional again in 0.2.7). The two new bucket
48
+ defaults are required only with a provider.
11
49
 
12
50
  - `auth({ oidc: { providers: [{ id, name, issuer, clientIdEnv, clientSecretEnv, allowedDomains, allowedEmails,
13
51
  createAccounts, ... }] } })`: authorization code flow with PKCE S256, a one-time state bound to the browser by a
package/README.md CHANGED
@@ -177,6 +177,12 @@ the variables the provider names.
177
177
  allowlist is the gate. An account keeps one identity per provider: a new subject with an email that already has one
178
178
  (a recycled address) is refused with `auth.oidc_no_account`. `onRegistered` runs for a created account with
179
179
  `consent: null`, `fields: {}` and `oidcProvider: "<id>"`.
180
+ - **Display name.** The flow always requests `openid email profile`. Every sign-in whose ID token carries `name` (else
181
+ `given_name`) stores it on the account (`auth.users.display_name`), normalized: control characters dropped,
182
+ whitespace collapsed, trimmed, at most 200 characters. `AuthUser.displayName` (from `getCurrentUser`, `requireUser`
183
+ and every other reader) is that name, or null for a password account and a provider that sends none; a sign-in
184
+ without a name keeps the stored one. A malformed name claim is ignored, never a reason to refuse the sign-in.
185
+ Show it with a fallback: `user.displayName ?? user.email`.
180
186
  - **Session.** The callback ends the sessions the browser held and opens a normal auth session, so `requireUser`,
181
187
  `requireRole`, `adminEmails` and every module built on auth work unchanged. It answers a `303` to `next` (through
182
188
  `rewriteRedirect`), or to the login page with `?oidc_error=<code>`: `auth.oidc_failed` (the reason is in the log
@@ -192,9 +198,24 @@ the variables the provider names.
192
198
  without Next.
193
199
  - **Tests.** `createFakeOidcProvider({ clock })` from `@softure-ai/auth/testing` is a provider in memory (discovery,
194
200
  JWKS, token endpoint, real RS256 or ES256 signatures): pass `fake.definition` as a provider, `fake.fetch` as
195
- `oidc.fetch` and `fake.env` as the context's `env`; `fake.signIn(authorizeUrl, { subject, email, hostedDomain })`
201
+ `oidc.fetch` and `fake.env` as the context's `env`; `fake.signIn(authorizeUrl, { subject, email, hostedDomain, name, givenName })`
196
202
  answers the callback URL. It can break on purpose (`claims`, `signWith`, `rotateKeys`, `failNext`, `setDiscovery`).
197
203
 
204
+ **Without a provider.** OpenID Connect is opt-in: an app chooses its sign-in methods, and with no
205
+ `oidc.providers` nothing of it runs. What such an app still gets, and why it needs nothing:
206
+
207
+ - **Tables.** `softure migrate` creates `auth.identities` and `auth.oidc_states` for every app (migration `0005`):
208
+ a module's migrations run in one numbered sequence and cannot depend on its options. Without a provider nothing
209
+ writes to them; they stay empty. The privacy export and deletion read them by user and find nothing.
210
+ - **Rate limit buckets.** `oidc-start` and `oidc-callback` are required only with a provider. Spreading
211
+ `AUTH_RATE_LIMIT_BUCKETS` adds their definitions, which count nothing until a sign-in starts; an app that lists its
212
+ buckets by hand leaves them out.
213
+ - **Copy.** The `oidc` copy and the `errors.auth.oidc_*` codes are optional in `AuthMessages` (section 9); a
214
+ dictionary without them compiles.
215
+ - **Routes.** `app/api/auth/oidc/[provider]/callback/route.ts` is needed only with a provider; leave it unmounted.
216
+
217
+ The one step on a bump past 0.2.5: run `softure migrate`, as for any release with a migration.
218
+
198
219
  ## 4. Mounting
199
220
 
200
221
  One line per file, owned by the app (docs/02 §8):
@@ -625,11 +646,12 @@ module itself.
625
646
 
626
647
  `softure migrate` applies `migrations/0001_create_users_and_sessions.sql`,
627
648
  `0002_create_user_roles.sql`, `0003_create_password_resets.sql` and
628
- `0004_index_users_created_at.sql` (an index on `users.created_at` for billing's reminder mail) and
629
- `0005_create_identities_and_oidc_states.sql` after security's.
649
+ `0004_index_users_created_at.sql` (an index on `users.created_at` for billing's reminder mail),
650
+ `0005_create_identities_and_oidc_states.sql` and `0006_add_users_display_name.sql` after security's.
630
651
 
631
- - `auth.users(id uuid, email, password_hash, created_at, password_changed_at)`: the email is stored
632
- trimmed and lowercased (`CHECK`), unique; the hash must be a `scrypt$…` string.
652
+ - `auth.users(id uuid, email, password_hash, created_at, password_changed_at, display_name)`: the email is stored
653
+ trimmed and lowercased (`CHECK`), unique; the hash must be a `scrypt$…` string; `display_name` is null or the
654
+ OpenID Connect provider's name, trimmed, 1 to 200 characters (`CHECK`).
633
655
  - `auth.sessions(token_hash, user_id → users ON DELETE CASCADE, created_at, expires_at)`: only the
634
656
  sha256 of the cookie token is stored.
635
657
  - `auth.user_roles(user_id → users ON DELETE CASCADE, role, granted_at)`, primary key
@@ -726,7 +748,9 @@ translation under its locale, `auth({ messages: { de: authDe } })`. Groups: `fie
726
748
  `register`, `changePassword`, `forgotPassword`, `resetPassword`, `resetMail` (the reset mail of
727
749
  `mailingResetSender()`; `minutes` holds plural forms), `logout`, `oidc` (`signInWith` with `{provider}`, `divider`), and `errors.{auth,security,core}` keyed by the error code
728
750
  (`auth.invalid_credentials` → `errors.auth.invalid_credentials`). `getAuthErrorMessage(messages, code)`
729
- looks one up.
751
+ looks one up. In `AuthMessages` the OpenID Connect keys (`oidc` and `errors.auth.oidc_*`) are optional, so a dictionary
752
+ typed `AuthMessages` that predates them still compiles; `OidcSignIn` and `getAuthErrorMessage` read the English copy
753
+ for a key the dictionary lacks.
730
754
 
731
755
  ## 10. Hooks
732
756
 
@@ -748,10 +772,11 @@ sender. `enqueuePasswordReset` from `@softure-ai/auth/jobs` plugs `@softure-ai/j
748
772
 
749
773
  ## 11. GDPR
750
774
 
751
- The module stores an email, a password hash, session rows, role rows and pending reset rows. It
775
+ The module stores an email, a display name from an OpenID Connect provider, a password hash, session rows, role rows
776
+ and pending reset rows. It
752
777
  contributes to `@softure-ai/privacy` (`privacy` flags on):
753
778
 
754
- - **Export** (`exportAuthUserData`): the account (id, email, `createdAt`, `passwordChangedAt`),
779
+ - **Export** (`exportAuthUserData`): the account (id, email, `createdAt`, `passwordChangedAt`, `displayName`),
755
780
  stored roles with their grant dates, sessions (created and expiry dates) and a pending reset link
756
781
  (created and expiry dates), and OpenID Connect identities (provider, subject, email, created and last sign-in
757
782
  dates). Never the password hash or a token hash. A role held through
@@ -10,6 +10,12 @@ export interface AuthUser {
10
10
  readonly id: string;
11
11
  readonly email: string;
12
12
  readonly createdAt: Date;
13
+ /**
14
+ * The name the OpenID Connect provider sent at the latest sign-in that carried one (`name`, else `given_name`);
15
+ * null for a password account and for a provider that sends none. The package always sets it; it is optional only
16
+ * so an app's own `AuthUser` literals (tests, fakes) keep compiling, and `undefined` reads like null.
17
+ */
18
+ readonly displayName?: string | null;
13
19
  }
14
20
  /** A session just opened: the token goes into the cookie and is never stored. */
15
21
  export interface NewSession {
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,MAAM,MAAM,aAAa,GACrB,0BAA0B,GAC1B,oBAAoB,GACpB,kBAAkB,GAClB,yBAAyB,GACzB,wBAAwB,GACxB,uBAAuB,GACvB,0BAA0B,GAC1B,+BAA+B,GAC/B,yBAAyB,GACzB,sBAAsB,GACtB,gBAAgB,GAChB,0BAA0B,GAC1B,iCAAiC,GACjC,kBAAkB,GAClB,qBAAqB,GACrB,uBAAuB,GACvB,sBAAsB,CAAC;AAE3B,sGAAsG;AACtG,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,aAAa,EAAE,aAAa,MAAM,EAAE,CAAC,CAAC;AAEhF,0FAA0F;AAC1F,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG,OAAO,CAAC,iBAAiB,EAAE,uBAAuB,GAAG,8BAA8B,CAAC,GAAG,aAAa,CAAC;AAErJ,0FAA0F;AAC1F,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;CAC1B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AG,IAAI,CAAC;IACvD,8FAA8F;IAC9F,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAClD,qGAAqG;IACrG,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC;AAED,mEAAmE;AACnE,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,UAAU,GAAG,iBAAiB,GAAG,aAAa,GAAG,SAAS,CAAC;AAEjG;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC;IACzC,wEAAwE;IACxE,QAAQ,CAAC,KAAK,CAAC,EAAE,iBAAiB,CAAC;IACnC,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC;IAC/B,wFAAwF;IACxF,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,uBAAuB,EAAE,aAAkC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AA2EA,MAAM,CAAC,MAAM,uBAAuB,GAAkB,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC"}
1
+ {"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAiFA,MAAM,CAAC,MAAM,uBAAuB,GAAkB,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -11,7 +11,8 @@ export declare const REGISTRATION_CLOSED_ENV = "SOFTURE_SWITCH_AUTH_REGISTRATION
11
11
  * `register` and `login` per client address, `login-account` per email, `change-password` per user,
12
12
  * `password-reset` (link requests) and `password-reset-confirm` (new passwords) per client address,
13
13
  * `password-reset-account` per email, which bounds the mails one address can receive, and `oidc-start` and
14
- * `oidc-callback` (OpenID Connect sign-ins started and completed) per client address.
14
+ * `oidc-callback` (OpenID Connect sign-ins started and completed) per client address. The `oidc-*` buckets are
15
+ * required only with a provider and count nothing without one, so an app without OpenID Connect may leave them out.
15
16
  */
16
17
  export declare const AUTH_RATE_LIMIT_BUCKETS: {
17
18
  readonly register: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,SAAS,SAAS,CAAC;AAEhC,2DAA2D;AAC3D,eAAO,MAAM,0BAA0B,6BAA6B,CAAC;AAErE;;;GAGG;AACH,eAAO,MAAM,uBAAuB,4CAA4C,CAAC;AAEjF;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAU+B,CAAC;AAEpE;;;GAGG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCAyCf,CAAC;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,QAAQ,EACR,UAAU,EACV,mBAAmB,EACnB,eAAe,EACf,QAAQ,GACT,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC3F,OAAO,EACL,wBAAwB,EACxB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,YAA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AAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC3F,OAAO,EACL,wBAAwB,EACxB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,YAAY,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,0BAA0B,EAC1B,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,GACzB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -19,7 +19,8 @@ export const REGISTRATION_CLOSED_ENV = "SOFTURE_SWITCH_AUTH_REGISTRATION_CLOSED"
19
19
  * `register` and `login` per client address, `login-account` per email, `change-password` per user,
20
20
  * `password-reset` (link requests) and `password-reset-confirm` (new passwords) per client address,
21
21
  * `password-reset-account` per email, which bounds the mails one address can receive, and `oidc-start` and
22
- * `oidc-callback` (OpenID Connect sign-ins started and completed) per client address.
22
+ * `oidc-callback` (OpenID Connect sign-ins started and completed) per client address. The `oidc-*` buckets are
23
+ * required only with a provider and count nothing without one, so an app without OpenID Connect may leave them out.
23
24
  */
24
25
  export const AUTH_RATE_LIMIT_BUCKETS = {
25
26
  register: { limit: 5, windowMinutes: 15, key: "ip" },
@@ -39,7 +40,7 @@ export const AUTH_RATE_LIMIT_BUCKETS = {
39
40
  export const auth = defineModule({
40
41
  manifest: {
41
42
  id: MODULE_ID,
42
- version: "0.2.6",
43
+ version: "0.2.8",
43
44
  dependsOn: { security: "^0.2.0", mailing: "^0.2.0?", ops: "^0.2.0?", jobs: "^0.1.1?" },
44
45
  dbSchema: "auth",
45
46
  tables: ["users", "sessions", "user_roles", "password_resets", "identities", "oidc_states"],
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,qIAAqI;AACrI,sGAAsG;AACtG,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC;AAEhC,2DAA2D;AAC3D,MAAM,CAAC,MAAM,0BAA0B,GAAG,0BAA0B,CAAC;AAErE;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,yCAAyC,CAAC;AAEjF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,aAAa,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE;IACpD,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE;IAClD,eAAe,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE;IACjE,iBAAiB,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,aAAa,EAAE,EAA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AAmB,EAAqB,MAAM,qBAAqB,CAAC;AAC3F,OAAO,EACL,wBAAwB,GASzB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,0BAA0B,GAI3B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAsB,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC"}
@@ -107,7 +107,25 @@ export declare const authMessages: {
107
107
  };
108
108
  };
109
109
  };
110
- export type AuthMessages = typeof en;
111
- /** The copy for an error code; an unknown code gets the generic failure. */
110
+ type EnglishMessages = typeof en;
111
+ type AuthErrorCopy = EnglishMessages["errors"]["auth"];
112
+ type OidcErrorName = "oidc_failed" | "oidc_cancelled" | "oidc_not_allowed" | "oidc_no_account";
113
+ /**
114
+ * One locale's copy. The OpenID Connect keys (`oidc`, `errors.auth.oidc_*`) are optional, so a dictionary written
115
+ * before them still compiles; a missing one reads the English copy.
116
+ */
117
+ export type AuthMessages = Omit<EnglishMessages, "oidc" | "errors"> & {
118
+ readonly oidc?: EnglishMessages["oidc"];
119
+ readonly errors: Omit<EnglishMessages["errors"], "auth"> & {
120
+ readonly auth: Omit<AuthErrorCopy, OidcErrorName> & Partial<Pick<AuthErrorCopy, OidcErrorName>>;
121
+ };
122
+ };
123
+ /** The OpenID Connect copy of `messages`, or the English one when the dictionary has none. */
124
+ export declare function getOidcMessages(messages: AuthMessages): EnglishMessages["oidc"];
125
+ /**
126
+ * The copy for an error code: the dictionary's, else the English one (a key the dictionary predates); an unknown code
127
+ * gets the dictionary's generic failure.
128
+ */
112
129
  export declare function getAuthErrorMessage(messages: AuthMessages, code: AuthFormErrorCode): string;
130
+ export {};
113
131
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAE7B,0GAA0G;AAC1G,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAS,CAAC;AAEnC,MAAM,MAAM,YAAY,GAAG,OAAO,EAAE,CAAC;AAErC,4EAA4E;AAC5E,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAI3F"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAE7B,0GAA0G;AAC1G,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAS,CAAC;AAEnC,KAAK,eAAe,GAAG,OAAO,EAAE,CAAC;AACjC,KAAK,aAAa,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;AACvD,KAAK,aAAa,GAAG,aAAa,GAAG,gBAAgB,GAAG,kBAAkB,GAAG,iBAAiB,CAAC;AAE/F;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,QAAQ,CAAC,GAAG;IACpE,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,GAAG;QACzD,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,aAAa,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC;KACjG,CAAC;CACH,CAAC;AAEF,8FAA8F;AAC9F,wBAAgB,eAAe,CAAC,QAAQ,EAAE,YAAY,GAAG,eAAe,CAAC,MAAM,CAAC,CAE/E;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAE3F"}
@@ -1,10 +1,20 @@
1
1
  import { en } from "./en.js";
2
2
  /** The built-in English dictionary; an app passes partial overrides or its own translation per locale. */
3
3
  export const authMessages = { en };
4
- /** The copy for an error code; an unknown code gets the generic failure. */
4
+ /** The OpenID Connect copy of `messages`, or the English one when the dictionary has none. */
5
+ export function getOidcMessages(messages) {
6
+ return messages.oidc ?? en.oidc;
7
+ }
8
+ /**
9
+ * The copy for an error code: the dictionary's, else the English one (a key the dictionary predates); an unknown code
10
+ * gets the dictionary's generic failure.
11
+ */
5
12
  export function getAuthErrorMessage(messages, code) {
13
+ return findErrorCopy(messages.errors, code) ?? findErrorCopy(en.errors, code) ?? messages.errors.core.unexpected;
14
+ }
15
+ function findErrorCopy(errors, code) {
6
16
  const [namespace, name] = code.split(".", 2);
7
- const group = messages.errors[namespace];
8
- return (group !== undefined && Object.hasOwn(group, name) ? group[name] : undefined) ?? messages.errors.core.unexpected;
17
+ const group = errors[namespace];
18
+ return group !== undefined && Object.hasOwn(group, name) ? group[name] : undefined;
9
19
  }
10
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"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,SAAS,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAqB,CAAC;IACjE,MAAM,KAAK,GAA8D,MAAiF,CAAC,SAAS,CAAC,CAAC;IACtK,OAAO,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACrF,CAAC"}
package/dist/schema.d.ts CHANGED
@@ -88,9 +88,97 @@ export declare const users: import("drizzle-orm/pg-core").PgTableWithColumns<{
88
88
  identity: undefined;
89
89
  generated: undefined;
90
90
  }, {}, {}>;
91
+ displayName: import("drizzle-orm/pg-core").PgColumn<{
92
+ name: "display_name";
93
+ tableName: "users";
94
+ dataType: "string";
95
+ columnType: "PgText";
96
+ data: string;
97
+ driverParam: string;
98
+ notNull: false;
99
+ hasDefault: false;
100
+ isPrimaryKey: false;
101
+ isAutoincrement: false;
102
+ hasRuntimeDefault: false;
103
+ enumValues: [string, ...string[]];
104
+ baseColumn: never;
105
+ identity: undefined;
106
+ generated: undefined;
107
+ }, {}, {}>;
91
108
  };
92
109
  dialect: "pg";
93
110
  }>;
111
+ /** The columns of an `AuthUser`: every query that returns one selects these. */
112
+ export declare const AUTH_USER_COLUMNS: {
113
+ id: import("drizzle-orm/pg-core").PgColumn<{
114
+ name: "id";
115
+ tableName: "users";
116
+ dataType: "string";
117
+ columnType: "PgUUID";
118
+ data: string;
119
+ driverParam: string;
120
+ notNull: true;
121
+ hasDefault: true;
122
+ isPrimaryKey: true;
123
+ isAutoincrement: false;
124
+ hasRuntimeDefault: false;
125
+ enumValues: undefined;
126
+ baseColumn: never;
127
+ identity: undefined;
128
+ generated: undefined;
129
+ }, {}, {}>;
130
+ email: import("drizzle-orm/pg-core").PgColumn<{
131
+ name: "email";
132
+ tableName: "users";
133
+ dataType: "string";
134
+ columnType: "PgText";
135
+ data: string;
136
+ driverParam: string;
137
+ notNull: true;
138
+ hasDefault: false;
139
+ isPrimaryKey: false;
140
+ isAutoincrement: false;
141
+ hasRuntimeDefault: false;
142
+ enumValues: [string, ...string[]];
143
+ baseColumn: never;
144
+ identity: undefined;
145
+ generated: undefined;
146
+ }, {}, {}>;
147
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
148
+ name: "created_at";
149
+ tableName: "users";
150
+ dataType: "date";
151
+ columnType: "PgTimestamp";
152
+ data: Date;
153
+ driverParam: string;
154
+ notNull: true;
155
+ hasDefault: false;
156
+ isPrimaryKey: false;
157
+ isAutoincrement: false;
158
+ hasRuntimeDefault: false;
159
+ enumValues: undefined;
160
+ baseColumn: never;
161
+ identity: undefined;
162
+ generated: undefined;
163
+ }, {}, {}>;
164
+ displayName: import("drizzle-orm/pg-core").PgColumn<{
165
+ name: "display_name";
166
+ tableName: "users";
167
+ dataType: "string";
168
+ columnType: "PgText";
169
+ data: string;
170
+ driverParam: string;
171
+ notNull: false;
172
+ hasDefault: false;
173
+ isPrimaryKey: false;
174
+ isAutoincrement: false;
175
+ hasRuntimeDefault: false;
176
+ enumValues: [string, ...string[]];
177
+ baseColumn: never;
178
+ identity: undefined;
179
+ generated: undefined;
180
+ }, {}, {}>;
181
+ };
94
182
  export declare const sessions: import("drizzle-orm/pg-core").PgTableWithColumns<{
95
183
  name: "sessions";
96
184
  schema: "auth";
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,UAAU,gDAAmB,CAAC;AAE3C,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMhB,CAAC;AAEH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;EAUrB,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOzB,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAatB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQrB,CAAC"}
package/dist/schema.js CHANGED
@@ -1,6 +1,7 @@
1
1
  // Drizzle view of the module's tables (migrations/0001_create_users_and_sessions.sql,
2
2
  // 0002_create_user_roles.sql, 0003_create_password_resets.sql, the users.created_at index of
3
- // 0004_index_users_created_at.sql and 0005_create_identities_and_oidc_states.sql). The migrations are the source of truth; this file only types
3
+ // 0004_index_users_created_at.sql, 0005_create_identities_and_oidc_states.sql and
4
+ // 0006_add_users_display_name.sql). The migrations are the source of truth; this file only types
4
5
  // the queries. App tables may reference `users.id`.
5
6
  import { pgSchema, primaryKey, text, timestamp, unique, uuid } from "drizzle-orm/pg-core";
6
7
  export const authSchema = pgSchema("auth");
@@ -10,7 +11,10 @@ export const users = authSchema.table("users", {
10
11
  passwordHash: text("password_hash").notNull(),
11
12
  createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
12
13
  passwordChangedAt: timestamp("password_changed_at", { withTimezone: true }).notNull(),
14
+ displayName: text("display_name"),
13
15
  });
16
+ /** The columns of an `AuthUser`: every query that returns one selects these. */
17
+ export const AUTH_USER_COLUMNS = { id: users.id, email: users.email, createdAt: users.createdAt, displayName: users.displayName };
14
18
  export const sessions = authSchema.table("sessions", {
15
19
  t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EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAC/I,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,aAAa,EAAE;IACxD,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,UAAU,EAAE;IAC1C,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE;IACpC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE;IAC9B,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC,OAAO,EAAE;IAC7C,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE;IACrC,SAAS,EAAE,SAAS,CAAC,YAAY,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE;IACpE,SAAS,EAAE,SAAS,CAAC,YAAY,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE;CACrE,CAAC,CAAC"}
@@ -47,6 +47,6 @@ export async function loginUser(ctx, input) {
47
47
  .where(and(eq(users.id, user.id), eq(users.passwordHash, user.passwordHash)));
48
48
  }
49
49
  const session = await createSession(ctx, user.id);
50
- return ok({ user: { id: user.id, email: user.email, createdAt: user.createdAt }, session });
50
+ return ok({ user: { id: user.id, email: user.email, createdAt: user.createdAt, displayName: user.displayName }, session });
51
51
  }
52
52
  //# sourceMappingURL=login.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/server/login.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,iGAAiG;AACjG,gFAAgF;AAChF,OAAO,EAAE,GAAG,EAAE,EAAE,EAAqB,MAAM,kBAAkB,CAAC;AAE9D,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC/E,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE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C,CAAC;IAClD,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;AAC7H,CAAC"}
@@ -6,6 +6,8 @@ export interface OidcIdentity {
6
6
  readonly subject: string;
7
7
  /** Verified, trimmed and lowercased. */
8
8
  readonly email: string;
9
+ /** Normalized (`toDisplayName`); null when the token carries none, which keeps the stored one. */
10
+ readonly displayName: string | null;
9
11
  }
10
12
  export type OidcAccountResult = Ok<AuthUser> | Err<"auth.oidc_no_account">;
11
13
  export declare function resolveOidcAccount(ctx: AuthContext, provider: OidcProvider, identity: OidcIdentity): Promise<OidcAccountResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../../src/server/oidc/accounts.ts"],"names":[],"mappings":"AAKA,OAAO,EAAW,KAAK,GAAG,EAAE,KAAK,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,wCAAwC;IACxC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,iBAAiB,GAAG,EAAE,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAC,sBAAsB,CAAC,CAAC;AAE3E,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA2DrI"}
1
+ {"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../../src/server/oidc/accounts.ts"],"names":[],"mappings":"AAKA,OAAO,EAAW,KAAK,GAAG,EAAE,KAAK,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,wCAAwC;IACxC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,kGAAkG;IAClG,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;AAED,MAAM,MAAM,iBAAiB,GAAG,EAAE,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAC,sBAAsB,CAAC,CAAC;AAE3E,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA4DrI"}
@@ -1,11 +1,11 @@
1
1
  // The account an OpenID Connect identity signs in to. The provider's subject finds it (`auth.identities`), so an
2
2
  // email change at the provider keeps it; a first sign-in links the account with the same verified email, or creates
3
3
  // one with an unusable password when the provider may create accounts. One transaction, so two first sign-ins at
4
- // once end with one account and one identity.
4
+ // once end with one account and one identity. Every sign-in that carries a display name stores it on the account.
5
5
  import { randomBytes } from "node:crypto";
6
6
  import { err, ok } from "@softure-ai/core";
7
7
  import { and, eq } from "drizzle-orm";
8
- import { identities, users } from "../../schema.js";
8
+ import { AUTH_USER_COLUMNS, identities, users } from "../../schema.js";
9
9
  import { getAuthOptions } from "../options.js";
10
10
  import { hashPassword } from "../password.js";
11
11
  export async function resolveOidcAccount(ctx, provider, identity) {
@@ -15,7 +15,7 @@ export async function resolveOidcAccount(ctx, provider, identity) {
15
15
  const txCtx = { ...ctx, db: tx };
16
16
  const findLinked = async () => {
17
17
  const [row] = await tx
18
- .select({ id: users.id, email: users.email, createdAt: users.createdAt })
18
+ .select(AUTH_USER_COLUMNS)
19
19
  .from(identities)
20
20
  .innerJoin(users, eq(users.id, identities.userId))
21
21
  .where(and(eq(identities.provider, provider.id), eq(identities.subject, identity.subject)))
@@ -28,10 +28,10 @@ export async function resolveOidcAccount(ctx, provider, identity) {
28
28
  .update(identities)
29
29
  .set({ email: identity.email, lastLoginAt: now })
30
30
  .where(and(eq(identities.provider, provider.id), eq(identities.subject, identity.subject)));
31
- return ok(linked);
31
+ return ok(await storeDisplayName(tx, linked, identity.displayName));
32
32
  }
33
33
  let [user] = await tx
34
- .select({ id: users.id, email: users.email, createdAt: users.createdAt })
34
+ .select(AUTH_USER_COLUMNS)
35
35
  .from(users)
36
36
  .where(eq(users.email, identity.email))
37
37
  .limit(1);
@@ -43,14 +43,14 @@ export async function resolveOidcAccount(ctx, provider, identity) {
43
43
  const unusablePassword = await hashPassword(randomBytes(32).toString("base64url"), options.password.scrypt);
44
44
  const [created] = await tx
45
45
  .insert(users)
46
- .values({ email: identity.email, passwordHash: unusablePassword, createdAt: now, passwordChangedAt: now })
46
+ .values({ email: identity.email, passwordHash: unusablePassword, createdAt: now, passwordChangedAt: now, displayName: identity.displayName })
47
47
  .onConflictDoNothing({ target: users.email })
48
- .returning({ id: users.id, email: users.email, createdAt: users.createdAt });
48
+ .returning(AUTH_USER_COLUMNS);
49
49
  isCreated = created !== undefined;
50
50
  // Taken meanwhile by another sign-in or a registration: that account is the one to link.
51
51
  [user] =
52
52
  created === undefined
53
- ? await tx.select({ id: users.id, email: users.email, createdAt: users.createdAt }).from(users).where(eq(users.email, identity.email)).limit(1)
53
+ ? await tx.select(AUTH_USER_COLUMNS).from(users).where(eq(users.email, identity.email)).limit(1)
54
54
  : [created];
55
55
  if (user === undefined)
56
56
  return err("auth.oidc_no_account");
@@ -63,9 +63,17 @@ export async function resolveOidcAccount(ctx, provider, identity) {
63
63
  const nowLinked = await findLinked();
64
64
  if (nowLinked?.id !== user.id)
65
65
  return err("auth.oidc_no_account");
66
+ const signedIn = await storeDisplayName(tx, user, identity.displayName);
66
67
  if (isCreated)
67
- await options.onRegistered?.({ user, consent: null, fields: {}, oidcProvider: provider.id }, txCtx);
68
- return ok(user);
68
+ await options.onRegistered?.({ user: signedIn, consent: null, fields: {}, oidcProvider: provider.id }, txCtx);
69
+ return ok(signedIn);
69
70
  });
70
71
  }
72
+ /** The account with the provider's display name stored; unchanged when the token carries none or the same one. */
73
+ async function storeDisplayName(db, user, displayName) {
74
+ if (displayName === null || displayName === user.displayName)
75
+ return user;
76
+ await db.update(users).set({ displayName }).where(eq(users.id, user.id));
77
+ return { ...user, displayName };
78
+ }
71
79
  //# sourceMappingURL=accounts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"accounts.js","sourceRoot":"","sources":["../../../src/server/oidc/accounts.ts"],"names":[],"mappings":"AAAA,iHAAiH;AACjH,oHAAoH;AACpH,iHAAiH;AACjH,8CAA8C;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAE,EAAE,EAAqB,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAGtC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAW9C,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,GAAgB,EAAE,QAAsB,EAAE,QAAsB;IACvG,MAAM,OAAO,GAAG,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3C,MAAM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AC,sBAAsB,CAAC,CAAC;QAClE,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC;QACxE,IAAI,SAAS;YAAE,MAAM,OAAO,CAAC,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,YAAY,EAAE,QAAQ,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;QAC7H,OAAO,EAAE,CAAC,QAAQ,CAAC,CAAC;IACtB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,kHAAkH;AAClH,KAAK,UAAU,gBAAgB,CAAC,EAAqB,EAAE,IAAc,EAAE,WAA0B;IAC/F,IAAI,WAAW,KAAK,IAAI,IAAI,WAAW,KAAK,IAAI,CAAC,WAAW;QAAE,OAAO,IAAI,CAAC;IAC1E,MAAM,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IACzE,OAAO,EAAE,GAAG,IAAI,EAAE,WAAW,EAAE,CAAC;AAClC,CAAC"}
@@ -21,7 +21,7 @@ import { exchangeCode } from "./token-request.js";
21
21
  const RANDOM_BYTES = 32;
22
22
  const MAX_STATE_LENGTH = 512;
23
23
  const MAX_CODE_LENGTH = 4096;
24
- const REQUIRED_SCOPES = ["openid", "email"];
24
+ const REQUIRED_SCOPES = ["openid", "email", "profile"];
25
25
  /** Starts a sign-in with `provider`. Database errors propagate. */
26
26
  export async function startOidcSignIn(ctx, input) {
27
27
  assertAuthBuckets(ctx.config);
@@ -121,7 +121,7 @@ export async function completeOidcSignIn(ctx, input) {
121
121
  const email = getAllowedEmail(provider, claims.value);
122
122
  if (email === null)
123
123
  return err("auth.oidc_not_allowed");
124
- const account = await resolveOidcAccount(ctx, provider, { subject: claims.value.subject, email });
124
+ const account = await resolveOidcAccount(ctx, provider, { subject: claims.value.subject, email, displayName: claims.value.displayName });
125
125
  if (!account.ok)
126
126
  return account;
127
127
  await deleteExpiredSessions(ctx, account.value.id);