@softure-ai/auth 0.2.5 → 0.2.7
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.
- package/CHANGELOG.md +59 -0
- package/README.md +113 -15
- package/dist/contract.d.ts +11 -1
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js.map +1 -1
- package/dist/index.d.ts +72 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/dist/messages/en.d.ts +10 -0
- package/dist/messages/en.d.ts.map +1 -1
- package/dist/messages/en.js +10 -0
- package/dist/messages/en.js.map +1 -1
- package/dist/messages/index.d.ts +28 -2
- package/dist/messages/index.d.ts.map +1 -1
- package/dist/messages/index.js +13 -3
- package/dist/messages/index.js.map +1 -1
- package/dist/next/actions.d.ts +5 -0
- package/dist/next/actions.d.ts.map +1 -1
- package/dist/next/actions.js +26 -15
- package/dist/next/actions.js.map +1 -1
- package/dist/next/index.d.ts +2 -1
- package/dist/next/index.d.ts.map +1 -1
- package/dist/next/index.js +2 -1
- package/dist/next/index.js.map +1 -1
- package/dist/next/oidc-cookie.d.ts +7 -0
- package/dist/next/oidc-cookie.d.ts.map +1 -0
- package/dist/next/oidc-cookie.js +25 -0
- package/dist/next/oidc-cookie.js.map +1 -0
- package/dist/next/oidc-login-url.d.ts +4 -0
- package/dist/next/oidc-login-url.d.ts.map +1 -0
- package/dist/next/oidc-login-url.js +13 -0
- package/dist/next/oidc-login-url.js.map +1 -0
- package/dist/next/oidc-route.d.ts +7 -0
- package/dist/next/oidc-route.d.ts.map +1 -0
- package/dist/next/oidc-route.js +48 -0
- package/dist/next/oidc-route.js.map +1 -0
- package/dist/next/pages.d.ts +5 -0
- package/dist/next/pages.d.ts.map +1 -1
- package/dist/next/pages.js +19 -4
- package/dist/next/pages.js.map +1 -1
- package/dist/next/params.d.ts +2 -0
- package/dist/next/params.d.ts.map +1 -1
- package/dist/next/params.js +2 -0
- package/dist/next/params.js.map +1 -1
- package/dist/next/previous-session.d.ts +6 -0
- package/dist/next/previous-session.d.ts.map +1 -0
- package/dist/next/previous-session.js +23 -0
- package/dist/next/previous-session.js.map +1 -0
- package/dist/options.d.ts +99 -1
- package/dist/options.d.ts.map +1 -1
- package/dist/options.js +80 -0
- package/dist/options.js.map +1 -1
- package/dist/proxy/index.d.ts.map +1 -1
- package/dist/proxy/index.js +3 -1
- package/dist/proxy/index.js.map +1 -1
- package/dist/schema.d.ts +323 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +26 -3
- package/dist/schema.js.map +1 -1
- package/dist/server/change-password.d.ts +1 -1
- package/dist/server/change-password.d.ts.map +1 -1
- package/dist/server/change-password.js +3 -0
- package/dist/server/change-password.js.map +1 -1
- package/dist/server/health.d.ts.map +1 -1
- package/dist/server/health.js +2 -0
- package/dist/server/health.js.map +1 -1
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/login.d.ts +1 -1
- package/dist/server/login.d.ts.map +1 -1
- package/dist/server/login.js +4 -2
- package/dist/server/login.js.map +1 -1
- package/dist/server/oidc/accounts.d.ts +14 -0
- package/dist/server/oidc/accounts.d.ts.map +1 -0
- package/dist/server/oidc/accounts.js +79 -0
- package/dist/server/oidc/accounts.js.map +1 -0
- package/dist/server/oidc/context.d.ts +37 -0
- package/dist/server/oidc/context.d.ts.map +1 -0
- package/dist/server/oidc/context.js +34 -0
- package/dist/server/oidc/context.js.map +1 -0
- package/dist/server/oidc/discovery.d.ts +24 -0
- package/dist/server/oidc/discovery.d.ts.map +1 -0
- package/dist/server/oidc/discovery.js +109 -0
- package/dist/server/oidc/discovery.js.map +1 -0
- package/dist/server/oidc/flow.d.ts +49 -0
- package/dist/server/oidc/flow.d.ts.map +1 -0
- package/dist/server/oidc/flow.js +168 -0
- package/dist/server/oidc/flow.js.map +1 -0
- package/dist/server/oidc/id-token.d.ts +45 -0
- package/dist/server/oidc/id-token.d.ts.map +1 -0
- package/dist/server/oidc/id-token.js +122 -0
- package/dist/server/oidc/id-token.js.map +1 -0
- package/dist/server/oidc/index.d.ts +4 -0
- package/dist/server/oidc/index.d.ts.map +1 -0
- package/dist/server/oidc/index.js +4 -0
- package/dist/server/oidc/index.js.map +1 -0
- package/dist/server/oidc/token-request.d.ts +13 -0
- package/dist/server/oidc/token-request.d.ts.map +1 -0
- package/dist/server/oidc/token-request.js +49 -0
- package/dist/server/oidc/token-request.js.map +1 -0
- package/dist/server/password-reset.d.ts +1 -1
- package/dist/server/password-reset.d.ts.map +1 -1
- package/dist/server/password-reset.js +7 -7
- package/dist/server/password-reset.js.map +1 -1
- package/dist/server/privacy.d.ts +10 -0
- package/dist/server/privacy.d.ts.map +1 -1
- package/dist/server/privacy.js +18 -6
- package/dist/server/privacy.js.map +1 -1
- package/dist/server/rate-limits.d.ts +4 -1
- package/dist/server/rate-limits.d.ts.map +1 -1
- package/dist/server/rate-limits.js +10 -3
- package/dist/server/rate-limits.js.map +1 -1
- package/dist/server/register.js +2 -2
- package/dist/server/register.js.map +1 -1
- package/dist/server/sessions.js +2 -2
- package/dist/server/sessions.js.map +1 -1
- package/dist/server/switches.d.ts +1 -1
- package/dist/server/switches.d.ts.map +1 -1
- package/dist/server/switches.js +3 -1
- package/dist/server/switches.js.map +1 -1
- package/dist/testing/account.js +2 -2
- package/dist/testing/account.js.map +1 -1
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +3 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/oidc-provider.d.ts +68 -0
- package/dist/testing/oidc-provider.d.ts.map +1 -0
- package/dist/testing/oidc-provider.js +185 -0
- package/dist/testing/oidc-provider.js.map +1 -0
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +1 -0
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/oidc-sign-in.d.ts +25 -0
- package/dist/ui/oidc-sign-in.d.ts.map +1 -0
- package/dist/ui/oidc-sign-in.js +19 -0
- package/dist/ui/oidc-sign-in.js.map +1 -0
- package/migrations/0005_create_identities_and_oidc_states.sql +34 -0
- package/migrations/0006_add_users_display_name.sql +8 -0
- package/module.json +3 -2
- package/package.json +2 -2
- package/src/contract.ts +16 -1
- package/src/index.ts +20 -5
- package/src/messages/en.ts +10 -0
- package/src/messages/index.ts +29 -4
- package/src/next/actions.ts +23 -14
- package/src/next/index.ts +2 -0
- package/src/next/oidc-cookie.ts +31 -0
- package/src/next/oidc-login-url.ts +14 -0
- package/src/next/oidc-route.ts +48 -0
- package/src/next/pages.tsx +38 -11
- package/src/next/params.ts +3 -0
- package/src/next/previous-session.ts +23 -0
- package/src/options.ts +86 -1
- package/src/proxy/index.ts +3 -1
- package/src/schema.ts +33 -3
- package/src/server/change-password.ts +3 -0
- package/src/server/health.ts +2 -0
- package/src/server/index.ts +17 -0
- package/src/server/login.ts +3 -2
- package/src/server/oidc/accounts.ts +92 -0
- package/src/server/oidc/context.ts +56 -0
- package/src/server/oidc/discovery.ts +133 -0
- package/src/server/oidc/flow.ts +196 -0
- package/src/server/oidc/id-token.ts +143 -0
- package/src/server/oidc/index.ts +14 -0
- package/src/server/oidc/token-request.ts +59 -0
- package/src/server/password-reset.ts +7 -7
- package/src/server/privacy.ts +28 -6
- package/src/server/rate-limits.ts +11 -3
- package/src/server/register.ts +2 -2
- package/src/server/sessions.ts +2 -2
- package/src/server/switches.ts +2 -1
- package/src/testing/account.ts +2 -2
- package/src/testing/index.ts +10 -1
- package/src/testing/oidc-provider.ts +254 -0
- package/src/ui/index.ts +1 -0
- package/src/ui/oidc-sign-in.tsx +61 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,65 @@ 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.7
|
|
8
|
+
|
|
9
|
+
- `AuthMessages`: the OpenID Connect keys (`oidc`, `errors.auth.oidc_failed`, `oidc_cancelled`, `oidc_not_allowed`,
|
|
10
|
+
`oidc_no_account`) are optional (#786). In 0.2.6 they were required, so an app with its own dictionary typed
|
|
11
|
+
`AuthMessages` stopped compiling, although that release was described as additive. A missing key reads the English
|
|
12
|
+
copy: `OidcSignIn` falls back to `authMessages.en.oidc`, and `getAuthErrorMessage` to the English message of a known
|
|
13
|
+
code before the dictionary's generic failure. No change for an app.
|
|
14
|
+
- `AuthUser.displayName` (`string | null`): the name an OpenID Connect provider sends (`name`, else `given_name`),
|
|
15
|
+
stored on the account at every sign-in that carries one and kept when a sign-in carries none (#802). Null for a
|
|
16
|
+
password account. Normalized (control characters dropped, whitespace collapsed, trimmed, at most 200 characters); a
|
|
17
|
+
malformed claim is ignored. The property is optional in the type, so an app's own `AuthUser` literals keep
|
|
18
|
+
compiling; the package always sets it.
|
|
19
|
+
- New column `auth.users.display_name` (migration `0006`, nullable, no rewrite). The privacy export lists
|
|
20
|
+
`account.displayName`; the deletion removes it with the account.
|
|
21
|
+
- The OpenID Connect flow always requests the `profile` scope with `openid email`, so Google sends the name. Google
|
|
22
|
+
shows it as part of the basic sign-in consent.
|
|
23
|
+
- `createFakeOidcProvider`: `FakeOidcUser` gains `name` and `givenName`.
|
|
24
|
+
|
|
25
|
+
Migration for an app: run `softure migrate` (migration `0006`). To show the signed-in user by name, read
|
|
26
|
+
`user.displayName ?? user.email`. Users who signed in before the release get their name at their next sign-in.
|
|
27
|
+
|
|
28
|
+
## 0.2.6
|
|
29
|
+
|
|
30
|
+
Sign in with an OpenID Connect provider (Google), limited to allowed domains or emails (#769). Additive: an app without
|
|
31
|
+
`oidc` sees no change except two new bucket defaults.
|
|
32
|
+
|
|
33
|
+
- `auth({ oidc: { providers: [{ id, name, issuer, clientIdEnv, clientSecretEnv, allowedDomains, allowedEmails,
|
|
34
|
+
createAccounts, ... }] } })`: authorization code flow with PKCE S256, a one-time state bound to the browser by a
|
|
35
|
+
short-lived cookie, a nonce, and the ID token verified against the issuer's JWKS (RS256, ES256). `email_verified`
|
|
36
|
+
is required, then the allowlist; for Google a domain match also needs the `hd` claim (`requireHostedDomain`).
|
|
37
|
+
- New tables `auth.identities` (provider, subject → account; one per provider and account) and `auth.oidc_states`
|
|
38
|
+
(migration `0005`). A first sign-in links the account with the same verified email or creates one without a usable
|
|
39
|
+
password; later sign-ins find it by the provider's subject.
|
|
40
|
+
- `password: { enabled: false }`: only the provider buttons; login, registration, reset and password change refuse.
|
|
41
|
+
- `oidcSignInAction` and `oidcCallbackRoute` in `/next`, `OidcSignIn` in `/ui`, `startOidcSignIn` and
|
|
42
|
+
`completeOidcSignIn` in `/server`, `createFakeOidcProvider` in `/testing`. `LoginPage` shows the buttons and the
|
|
43
|
+
`?oidc_error=` message.
|
|
44
|
+
- `AUTH_RATE_LIMIT_BUCKETS` gains `oidc-start` and `oidc-callback` (20 per 15 minutes per client address), required
|
|
45
|
+
only with a provider. New error codes `auth.oidc_failed`, `auth.oidc_cancelled`, `auth.oidc_not_allowed`,
|
|
46
|
+
`auth.oidc_no_account`; new copy `oidc.signInWith`, `oidc.divider` and the four error messages.
|
|
47
|
+
- `RegisteredEvent` gains `oidcProvider` (`null` from the register form); `ChangePasswordErrorCode` gains
|
|
48
|
+
`auth.forbidden`. The privacy export lists `identities`, and the deletion removes them.
|
|
49
|
+
- Needs `@softure-ai/core` `^0.2.4` (form bodies and error bodies of `requestJson`).
|
|
50
|
+
|
|
51
|
+
Migration for an app that wants Google-only sign-in (for example one behind Cloudflare Access today):
|
|
52
|
+
|
|
53
|
+
1. Run `softure migrate` (adds the two tables).
|
|
54
|
+
2. In Google Cloud, create an OAuth client of type "Web application" with the redirect URI
|
|
55
|
+
`<APP_ORIGIN>/api/auth/oidc/google/callback`; for a Workspace-only app set the consent screen to "Internal".
|
|
56
|
+
3. Set `GOOGLE_AUTH_CLIENT_ID` and `GOOGLE_AUTH_CLIENT_SECRET` in every environment.
|
|
57
|
+
4. Add the provider to `auth({ oidc: { providers: [...] } })` with `issuer: "https://accounts.google.com"` and
|
|
58
|
+
`allowedDomains` (and/or `allowedEmails`), and `password: { enabled: false }` to drop the password form.
|
|
59
|
+
5. Mount `app/api/auth/oidc/[provider]/callback/route.ts` with `export { oidcCallbackRoute as GET } from
|
|
60
|
+
"@softure-ai/auth/next";`. The app's security buckets already have the new ones when it spreads
|
|
61
|
+
`AUTH_RATE_LIMIT_BUCKETS`; otherwise add `oidc-start` and `oidc-callback`.
|
|
62
|
+
6. Sign in once: the existing owner account (same email) is linked, nothing else changes. Then the outer sign-in in
|
|
63
|
+
front of the host (Cloudflare Access) and its bypass list can go, and the `create-account` password account and
|
|
64
|
+
change-password page are no longer needed.
|
|
65
|
+
|
|
7
66
|
## 0.2.5
|
|
8
67
|
|
|
9
68
|
- The auth forms' submit button keeps its width while sending (#616): `LoginForm`, `RegisterForm`,
|
package/README.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# @softure-ai/auth
|
|
2
2
|
|
|
3
3
|
Accounts for a Next.js app: register with a required consent, login, logout, password change,
|
|
4
|
-
password reset by an emailed link,
|
|
4
|
+
password reset by an emailed link, sign-in with an OpenID Connect provider (Google) limited to allowed domains or
|
|
5
|
+
emails, roles with admin-only surfaces that fail closed, database sessions, a route guard for `proxy.ts`, and ready pages and forms. The reference module
|
|
5
6
|
of the SOFTURE standard (docs/02): it has every layer, from migrations to messages. It counts
|
|
6
7
|
attempts with the rate limiter of `@softure-ai/security`, and its route guard is separate from
|
|
7
8
|
channel tagging.
|
|
@@ -17,7 +18,9 @@ script), a `create-account` script for the first account of an app with registra
|
|
|
17
18
|
`@softure-ai/auth/mailing` sends password reset mails through `@softure-ai/mailing`
|
|
18
19
|
(`mailingResetSender()`); `@softure-ai/auth/jobs` sends them from a background job of `@softure-ai/jobs` with
|
|
19
20
|
retry (`enqueuePasswordReset`, `passwordResetJobHandlers`). `@softure-ai/auth/testing` creates accounts directly in the database for
|
|
20
|
-
tests (`createTestAccount`, section 4, "Tests").
|
|
21
|
+
tests (`createTestAccount`, section 4, "Tests") and ships a fake OpenID Connect provider (`createFakeOidcProvider`).
|
|
22
|
+
`auth({ oidc })` adds "Sign in with Google" (or any OpenID Connect provider) next to the password form, or instead of it
|
|
23
|
+
with `password: { enabled: false }` (section 3, "OpenID Connect sign-in").
|
|
21
24
|
|
|
22
25
|
## 2. Installation
|
|
23
26
|
|
|
@@ -119,10 +122,85 @@ successful or not, so a test suite that logs in many times from one address must
|
|
|
119
122
|
passwords for one email, from any addresses, block logins to that account for the rest of the
|
|
120
123
|
window, the owner's included. Raise its limit if that trade-off is wrong for your app. Auth checks
|
|
121
124
|
at its first call that the buckets it counts in exist and names the missing ones: the three
|
|
122
|
-
`password-reset*` buckets only when `passwordReset.send` is set
|
|
125
|
+
`password-reset*` buckets only when `passwordReset.send` is set, `oidc-start` and `oidc-callback` (per client address)
|
|
126
|
+
only with an OpenID Connect provider. A request whose client address
|
|
123
127
|
cannot be resolved is refused (`security.client_unidentified`); the security README shows resolver
|
|
124
128
|
chains for production and for development and test stacks.
|
|
125
129
|
|
|
130
|
+
### OpenID Connect sign-in
|
|
131
|
+
|
|
132
|
+
Sign in with Google, or any OpenID Connect provider, for the accounts of a Workspace domain or a short list of
|
|
133
|
+
emails. Off without providers. With `password: { enabled: false }` it is the only way in: no password, no
|
|
134
|
+
registration form, no outer sign-in in front of the host.
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
auth({
|
|
138
|
+
oidc: {
|
|
139
|
+
providers: [
|
|
140
|
+
{
|
|
141
|
+
id: "google", // the callback is /api/auth/oidc/google/callback
|
|
142
|
+
name: "Google", // the button reads "Sign in with Google" (messages.oidc.signInWith)
|
|
143
|
+
issuer: "https://accounts.google.com", // discovery: <issuer>/.well-known/openid-configuration
|
|
144
|
+
clientIdEnv: "GOOGLE_AUTH_CLIENT_ID",
|
|
145
|
+
clientSecretEnv: "GOOGLE_AUTH_CLIENT_SECRET",
|
|
146
|
+
allowedDomains: ["example.com"], // a verified email of these domains...
|
|
147
|
+
allowedEmails: ["partner@other.test"], // ...or one of these emails
|
|
148
|
+
authorizeParams: { prompt: "select_account", hd: "example.com" }, // optional, sent as they are
|
|
149
|
+
createAccounts: true, // default; false only links existing accounts
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
},
|
|
153
|
+
password: { enabled: false }, // optional: hide the password form and refuse every password route
|
|
154
|
+
});
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
At the provider, register `<appOrigin>/api/auth/oidc/<id>/callback` as the redirect URI (Google: an OAuth client of
|
|
158
|
+
type "Web application"; for a Workspace-only app, set the consent screen to "Internal") and put its id and secret in
|
|
159
|
+
the variables the provider names.
|
|
160
|
+
|
|
161
|
+
- **Flow.** The button posts to `oidcSignInAction`: it counts `oidc-start`, stores the sign-in (`auth.oidc_states`:
|
|
162
|
+
the sha256 of a one-time `state`, a `nonce`, a PKCE S256 verifier and `next`), keeps the state in a short-lived
|
|
163
|
+
`<cookie>_oidc` cookie (host-only, `SameSite=Lax`) and sends the browser to the provider. The callback route counts
|
|
164
|
+
`oidc-callback`, requires the cookie's state (so a callback started in another browser is refused), consumes the
|
|
165
|
+
row, exchanges the code (client secret in the form, or `clientAuth: "basic"`) and verifies the ID token: RS256 or
|
|
166
|
+
ES256 signature against the issuer's JWKS (refetched once a minute at most when a key id is unknown), `iss`,
|
|
167
|
+
`aud`/`azp`, `exp`, `iat`, `nonce`. Discovery must name the configured issuer and https endpoints (http only on
|
|
168
|
+
localhost).
|
|
169
|
+
- **Who may sign in.** `email_verified` is required, then the email must be in `allowedEmails` or its domain in
|
|
170
|
+
`allowedDomains` (one of the two lists is required). For `https://accounts.google.com`, `requireHostedDomain`
|
|
171
|
+
defaults to true: a domain match also needs Google's `hd` claim to name that domain, because a consumer Google
|
|
172
|
+
account can carry a verified address of any domain. A refused identity goes back to the login page with
|
|
173
|
+
`?oidc_error=auth.oidc_not_allowed` and never gets an account.
|
|
174
|
+
- **Accounts.** The provider's subject finds the account (`auth.identities`), so an email change at the provider does
|
|
175
|
+
not lock its owner out. A first sign-in links the account with the same verified email, or creates one (with an
|
|
176
|
+
unusable password) when `createAccounts` is on; account creation does not look at `registrationClosed`, the
|
|
177
|
+
allowlist is the gate. An account keeps one identity per provider: a new subject with an email that already has one
|
|
178
|
+
(a recycled address) is refused with `auth.oidc_no_account`. `onRegistered` runs for a created account with
|
|
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`.
|
|
186
|
+
- **Session.** The callback ends the sessions the browser held and opens a normal auth session, so `requireUser`,
|
|
187
|
+
`requireRole`, `adminEmails` and every module built on auth work unchanged. It answers a `303` to `next` (through
|
|
188
|
+
`rewriteRedirect`), or to the login page with `?oidc_error=<code>`: `auth.oidc_failed` (the reason is in the log
|
|
189
|
+
only: `OpenID Connect sign-in with google failed: id_token audience`), `auth.oidc_cancelled`,
|
|
190
|
+
`auth.oidc_not_allowed`, `auth.oidc_no_account`, or a rate limit code.
|
|
191
|
+
- **Passwords off.** `password: { enabled: false }` (needs a provider): `LoginPage` shows only the provider buttons,
|
|
192
|
+
`loginUser` answers `auth.invalid_credentials`, registration is closed, password reset is off and the
|
|
193
|
+
change-password page is not found (`changePassword` answers `auth.forbidden`).
|
|
194
|
+
- **Your own page.** `OidcSignIn` from `@softure-ai/auth/ui` renders the buttons
|
|
195
|
+
(`<OidcSignIn action={oidcSignInAction} providers={[{ id: "google", name: "Google" }]} messages={…} next="/" />`),
|
|
196
|
+
with `error`, `hasDivider`, `classNames` (`root`, `form`, `submit`, `divider`), `submitVariant` (`secondary` by
|
|
197
|
+
default) and `unstyled`. `startOidcSignIn` and `completeOidcSignIn` in `@softure-ai/auth/server` are the flow
|
|
198
|
+
without Next.
|
|
199
|
+
- **Tests.** `createFakeOidcProvider({ clock })` from `@softure-ai/auth/testing` is a provider in memory (discovery,
|
|
200
|
+
JWKS, token endpoint, real RS256 or ES256 signatures): pass `fake.definition` as a provider, `fake.fetch` as
|
|
201
|
+
`oidc.fetch` and `fake.env` as the context's `env`; `fake.signIn(authorizeUrl, { subject, email, hostedDomain, name, givenName })`
|
|
202
|
+
answers the callback URL. It can break on purpose (`claims`, `signWith`, `rotateKeys`, `failNext`, `setDiscovery`).
|
|
203
|
+
|
|
126
204
|
## 4. Mounting
|
|
127
205
|
|
|
128
206
|
One line per file, owned by the app (docs/02 §8):
|
|
@@ -139,8 +217,12 @@ export { ForgotPasswordPage as default } from "@softure-ai/auth/next";
|
|
|
139
217
|
export { ResetPasswordPage as default } from "@softure-ai/auth/next";
|
|
140
218
|
// app/api/auth/session/route.ts: { user: { id, email } | null }, never cached
|
|
141
219
|
export { getSessionRoute as GET } from "@softure-ai/auth/next";
|
|
220
|
+
// app/api/auth/oidc/[provider]/callback/route.ts (with auth({ oidc })): the OpenID Connect callback
|
|
221
|
+
export { oidcCallbackRoute as GET } from "@softure-ai/auth/next";
|
|
142
222
|
```
|
|
143
223
|
|
|
224
|
+
The route guard never guards `/api/auth/oidc/…`: a visitor arrives there without a session.
|
|
225
|
+
|
|
144
226
|
The register page takes a consent label (links to your terms) and inputs of your own through
|
|
145
227
|
`createRegisterPage`, so you keep the module's page:
|
|
146
228
|
|
|
@@ -549,17 +631,23 @@ module itself.
|
|
|
549
631
|
|
|
550
632
|
`softure migrate` applies `migrations/0001_create_users_and_sessions.sql`,
|
|
551
633
|
`0002_create_user_roles.sql`, `0003_create_password_resets.sql` and
|
|
552
|
-
`0004_index_users_created_at.sql` (an index on `users.created_at` for billing's reminder mail)
|
|
553
|
-
after security's.
|
|
634
|
+
`0004_index_users_created_at.sql` (an index on `users.created_at` for billing's reminder mail),
|
|
635
|
+
`0005_create_identities_and_oidc_states.sql` and `0006_add_users_display_name.sql` after security's.
|
|
554
636
|
|
|
555
|
-
- `auth.users(id uuid, email, password_hash, created_at, password_changed_at)`: the email is stored
|
|
556
|
-
trimmed and lowercased (`CHECK`), unique; the hash must be a `scrypt$…` string
|
|
637
|
+
- `auth.users(id uuid, email, password_hash, created_at, password_changed_at, display_name)`: the email is stored
|
|
638
|
+
trimmed and lowercased (`CHECK`), unique; the hash must be a `scrypt$…` string; `display_name` is null or the
|
|
639
|
+
OpenID Connect provider's name, trimmed, 1 to 200 characters (`CHECK`).
|
|
557
640
|
- `auth.sessions(token_hash, user_id → users ON DELETE CASCADE, created_at, expires_at)`: only the
|
|
558
641
|
sha256 of the cookie token is stored.
|
|
559
642
|
- `auth.user_roles(user_id → users ON DELETE CASCADE, role, granted_at)`, primary key
|
|
560
643
|
`(user_id, role)`; the role name has the declared shape (`CHECK`).
|
|
561
644
|
- `auth.password_resets(user_id → users ON DELETE CASCADE, token_hash, created_at, expires_at)`,
|
|
562
645
|
primary key `user_id` (one pending link per account), unique `token_hash` (sha256 only).
|
|
646
|
+
- `auth.identities(provider, subject, user_id → users ON DELETE CASCADE, email, created_at, last_login_at)`, primary
|
|
647
|
+
key `(provider, subject)`, unique `(user_id, provider)`: the OpenID Connect identities; `email` is the verified
|
|
648
|
+
email of the last sign-in.
|
|
649
|
+
- `auth.oidc_states(state_hash, provider, nonce, code_verifier, next_path, created_at, expires_at)`: sign-ins in
|
|
650
|
+
flight (sha256 of the state only), one-time; expired rows go when the next sign-in starts.
|
|
563
651
|
|
|
564
652
|
Your own tables reference `users.id` (exported as the Drizzle table `users`; roles as `userRoles`); keep app columns in
|
|
565
653
|
your own 1:1 table, never in `auth.users`. Expired sessions of a user are deleted at their next
|
|
@@ -603,6 +691,7 @@ its NFC form fails, then rehashes it in NFC.
|
|
|
603
691
|
| Name | Required | Meaning |
|
|
604
692
|
| --- | --- | --- |
|
|
605
693
|
| `SOFTURE_SWITCH_AUTH_REGISTRATION_CLOSED` | no | `true` / `1` closes registration, `false` / `0` opens it, over the declared default. Any other value closes it and logs the variable name. When the app defines the switch in `@softure-ai/feature-switches`, that module reads this variable by its own rules (`on` / `off` too; an unreadable value gives the fail mode). |
|
|
694
|
+
| `<clientIdEnv>`, `<clientSecretEnv>` | with `oidc` | The client id and secret of each OpenID Connect provider, under the names its entry declares (e.g. `GOOGLE_AUTH_CLIENT_ID`, `GOOGLE_AUTH_CLIENT_SECRET`). A missing one fails the sign-in and logs the variable's name. |
|
|
606
695
|
| `SEED_EMAIL`, `SEED_PASSWORD` | for `runSeedAccount` | The development account the seed entry creates (section 4, "Development seed"). |
|
|
607
696
|
|
|
608
697
|
## 7. Switches
|
|
@@ -642,19 +731,22 @@ replace with your own page around the forms.
|
|
|
642
731
|
`auth({ messages: { en: { login: { title: "Sign in to Acme" } } } })`; another language is the app's own
|
|
643
732
|
translation under its locale, `auth({ messages: { de: authDe } })`. Groups: `fields`, `login`,
|
|
644
733
|
`register`, `changePassword`, `forgotPassword`, `resetPassword`, `resetMail` (the reset mail of
|
|
645
|
-
`mailingResetSender()`; `minutes` holds plural forms), `logout`, and `errors.{auth,security,core}` keyed by the error code
|
|
734
|
+
`mailingResetSender()`; `minutes` holds plural forms), `logout`, `oidc` (`signInWith` with `{provider}`, `divider`), and `errors.{auth,security,core}` keyed by the error code
|
|
646
735
|
(`auth.invalid_credentials` → `errors.auth.invalid_credentials`). `getAuthErrorMessage(messages, code)`
|
|
647
|
-
looks one up.
|
|
736
|
+
looks one up. In `AuthMessages` the OpenID Connect keys (`oidc` and `errors.auth.oidc_*`) are optional, so a dictionary
|
|
737
|
+
typed `AuthMessages` that predates them still compiles; `OidcSignIn` and `getAuthErrorMessage` read the English copy
|
|
738
|
+
for a key the dictionary lacks.
|
|
648
739
|
|
|
649
740
|
## 10. Hooks
|
|
650
741
|
|
|
651
|
-
`onRegistered({ user, consent, fields }, ctx)`: after the user row is inserted, in the same
|
|
742
|
+
`onRegistered({ user, consent, fields, oidcProvider }, ctx)`: after the user row is inserted, in the same
|
|
652
743
|
transaction (`ctx.db` is the transaction). `consent` is `{ acceptedAt }`, or `null` with
|
|
653
744
|
`requireConsent: false`. `fields` holds the declared `registrationFields` the form sent, by name
|
|
654
745
|
(strings cut to 512 characters, empty ones left out). They come from the client, and a link can set
|
|
655
746
|
a carried one, so validate them before you store them. The hook runs inside the register action,
|
|
656
747
|
so it can also read the request (`headers()`, `cookies()` from `next/headers`). A thrown error rolls the registration back and the user sees a generic
|
|
657
|
-
failure. `@softure-ai/privacy` stores the consent through it.
|
|
748
|
+
failure. `@softure-ai/privacy` stores the consent through it. An account created by an OpenID Connect sign-in runs it
|
|
749
|
+
too, with `consent: null`, `fields: {}` and `oidcProvider` set to the provider's id (`null` for the register form).
|
|
658
750
|
|
|
659
751
|
`passwordReset.send(link, user, details)`: after a reset request is answered, for an existing
|
|
660
752
|
account only (section 4, "Password reset"). `mailingResetSender()` from `@softure-ai/auth/mailing`
|
|
@@ -665,14 +757,16 @@ sender. `enqueuePasswordReset` from `@softure-ai/auth/jobs` plugs `@softure-ai/j
|
|
|
665
757
|
|
|
666
758
|
## 11. GDPR
|
|
667
759
|
|
|
668
|
-
The module stores an email, a password hash, session rows, role rows
|
|
760
|
+
The module stores an email, a display name from an OpenID Connect provider, a password hash, session rows, role rows
|
|
761
|
+
and pending reset rows. It
|
|
669
762
|
contributes to `@softure-ai/privacy` (`privacy` flags on):
|
|
670
763
|
|
|
671
|
-
- **Export** (`exportAuthUserData`): the account (id, email, `createdAt`, `passwordChangedAt`),
|
|
764
|
+
- **Export** (`exportAuthUserData`): the account (id, email, `createdAt`, `passwordChangedAt`, `displayName`),
|
|
672
765
|
stored roles with their grant dates, sessions (created and expiry dates) and a pending reset link
|
|
673
|
-
(created and expiry dates)
|
|
766
|
+
(created and expiry dates), and OpenID Connect identities (provider, subject, email, created and last sign-in
|
|
767
|
+
dates). Never the password hash or a token hash. A role held through
|
|
674
768
|
`adminEmails` is configuration, so it is not in the export.
|
|
675
|
-
- **Deletion** (`deleteAuthUserData`): the user's sessions, pending reset, roles and then the
|
|
769
|
+
- **Deletion** (`deleteAuthUserData`): the user's sessions, pending reset, roles, identities and then the
|
|
676
770
|
account row, so every session ends with the account. Privacy runs auth after the modules that
|
|
677
771
|
depend on it, and the app's contributors before all modules.
|
|
678
772
|
|
|
@@ -696,5 +790,9 @@ Rate limit rows of `security` hold only SHA-256 prefixes of the email and user i
|
|
|
696
790
|
- A temporary password from the script is not forced to change at the next login.
|
|
697
791
|
- `maxAccounts` limits the `create-account` script only; registration does not count accounts. An app that must hold
|
|
698
792
|
at most N accounts keeps registration closed.
|
|
793
|
+
- OpenID Connect: no Front-Channel or Back-Channel Logout (a sign-out at the provider leaves the app's session), no
|
|
794
|
+
refresh of the account's email from the provider (`users.email` keeps the first one; `identities.email` follows),
|
|
795
|
+
and `isCurrentPassword` cannot re-check an account that has no password of its own. With passwords on and reset
|
|
796
|
+
configured, the owner of an account created by a sign-in can still set a password through a reset link.
|
|
699
797
|
- A registration attempt reveals whether an email has an account (`auth.email_taken`); the
|
|
700
798
|
`register` rate limit bounds how fast anyone can ask.
|
package/dist/contract.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { CoreErrorCode } from "@softure-ai/core";
|
|
2
2
|
import type { SecurityErrorCode } from "@softure-ai/security";
|
|
3
|
-
export type AuthErrorCode = "auth.invalid_credentials" | "auth.email_invalid" | "auth.email_taken" | "auth.password_too_short" | "auth.password_too_long" | "auth.consent_required" | "auth.registration_closed" | "auth.current_password_invalid" | "auth.password_unchanged" | "auth.unauthenticated" | "auth.forbidden" | "auth.reset_token_invalid" | "auth.password_reset_unavailable";
|
|
3
|
+
export type AuthErrorCode = "auth.invalid_credentials" | "auth.email_invalid" | "auth.email_taken" | "auth.password_too_short" | "auth.password_too_long" | "auth.consent_required" | "auth.registration_closed" | "auth.current_password_invalid" | "auth.password_unchanged" | "auth.unauthenticated" | "auth.forbidden" | "auth.reset_token_invalid" | "auth.password_reset_unavailable" | "auth.oidc_failed" | "auth.oidc_cancelled" | "auth.oidc_not_allowed" | "auth.oidc_no_account";
|
|
4
|
+
/** Why an OpenID Connect sign-in did not open a session; the login page shows it (`?oidc_error=`). */
|
|
5
|
+
export type OidcSignInErrorCode = Extract<AuthErrorCode, `auth.oidc_${string}`>;
|
|
4
6
|
/** Every code an auth form can show: its own, the rate limiter's and the generic ones. */
|
|
5
7
|
export type AuthFormErrorCode = AuthErrorCode | Extract<SecurityErrorCode, "security.rate_limited" | "security.client_unidentified"> | CoreErrorCode;
|
|
6
8
|
/** A signed-up account, as the app sees it. The password hash never leaves the module. */
|
|
@@ -8,6 +10,12 @@ export interface AuthUser {
|
|
|
8
10
|
readonly id: string;
|
|
9
11
|
readonly email: string;
|
|
10
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;
|
|
11
19
|
}
|
|
12
20
|
/** A session just opened: the token goes into the cookie and is never stored. */
|
|
13
21
|
export interface NewSession {
|
|
@@ -27,6 +35,8 @@ export interface RegisteredEvent {
|
|
|
27
35
|
} | null;
|
|
28
36
|
/** The declared `registrationFields` the form sent, by name; client input, so validate it. */
|
|
29
37
|
readonly fields: Readonly<Record<string, string>>;
|
|
38
|
+
/** The OpenID Connect provider of a sign-in that created the account; null for the register form. */
|
|
39
|
+
readonly oidcProvider: string | null;
|
|
30
40
|
}
|
|
31
41
|
/** The fields of the auth forms that can carry their own error. */
|
|
32
42
|
export type AuthFormField = "email" | "password" | "currentPassword" | "newPassword" | "consent";
|
package/dist/contract.d.ts.map
CHANGED
|
@@ -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,CAAC;
|
|
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;AA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E,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"}
|
package/dist/contract.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"
|
|
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
|
@@ -10,7 +10,8 @@ export declare const REGISTRATION_CLOSED_ENV = "SOFTURE_SWITCH_AUTH_REGISTRATION
|
|
|
10
10
|
* Rate limit buckets auth consumes, with defaults to spread into `security({ buckets })`:
|
|
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
15
|
*/
|
|
15
16
|
export declare const AUTH_RATE_LIMIT_BUCKETS: {
|
|
16
17
|
readonly register: {
|
|
@@ -48,6 +49,16 @@ export declare const AUTH_RATE_LIMIT_BUCKETS: {
|
|
|
48
49
|
readonly windowMinutes: 15;
|
|
49
50
|
readonly key: "ip";
|
|
50
51
|
};
|
|
52
|
+
readonly "oidc-start": {
|
|
53
|
+
readonly limit: 20;
|
|
54
|
+
readonly windowMinutes: 15;
|
|
55
|
+
readonly key: "ip";
|
|
56
|
+
};
|
|
57
|
+
readonly "oidc-callback": {
|
|
58
|
+
readonly limit: 20;
|
|
59
|
+
readonly windowMinutes: 15;
|
|
60
|
+
readonly key: "ip";
|
|
61
|
+
};
|
|
51
62
|
};
|
|
52
63
|
/**
|
|
53
64
|
* Enables accounts in `softure.config.ts` (next to `security({ ... })`):
|
|
@@ -131,6 +142,10 @@ export declare const auth: import("@softure-ai/core").ModuleFactory<{
|
|
|
131
142
|
logout: {
|
|
132
143
|
submit: string;
|
|
133
144
|
};
|
|
145
|
+
oidc: {
|
|
146
|
+
signInWith: string;
|
|
147
|
+
divider: string;
|
|
148
|
+
};
|
|
134
149
|
errors: {
|
|
135
150
|
auth: {
|
|
136
151
|
invalid_credentials: string;
|
|
@@ -146,6 +161,10 @@ export declare const auth: import("@softure-ai/core").ModuleFactory<{
|
|
|
146
161
|
forbidden: string;
|
|
147
162
|
reset_token_invalid: string;
|
|
148
163
|
password_reset_unavailable: string;
|
|
164
|
+
oidc_failed: string;
|
|
165
|
+
oidc_cancelled: string;
|
|
166
|
+
oidc_not_allowed: string;
|
|
167
|
+
oidc_no_account: string;
|
|
149
168
|
};
|
|
150
169
|
security: {
|
|
151
170
|
rate_limited: string;
|
|
@@ -158,6 +177,7 @@ export declare const auth: import("@softure-ai/core").ModuleFactory<{
|
|
|
158
177
|
};
|
|
159
178
|
}, import("zod").ZodObject<{
|
|
160
179
|
password: import("zod").ZodPrefault<import("zod").ZodObject<{
|
|
180
|
+
enabled: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
161
181
|
minLength: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
162
182
|
scrypt: import("zod").ZodPrefault<import("zod").ZodObject<{
|
|
163
183
|
cost: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
@@ -187,16 +207,64 @@ export declare const auth: import("@softure-ai/core").ModuleFactory<{
|
|
|
187
207
|
enqueue: import("zod").ZodOptional<import("zod").ZodCustom<import("./password-reset-sender.js").PasswordResetEnqueuer, import("./password-reset-sender.js").PasswordResetEnqueuer>>;
|
|
188
208
|
ttlMinutes: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
189
209
|
}, import("zod/v4/core").$strict>>;
|
|
210
|
+
oidc: import("zod").ZodPrefault<import("zod").ZodObject<{
|
|
211
|
+
providers: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodPipe<import("zod").ZodObject<{
|
|
212
|
+
id: import("zod").ZodString;
|
|
213
|
+
name: import("zod").ZodString;
|
|
214
|
+
issuer: import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodTransform<string, string>>;
|
|
215
|
+
clientIdEnv: import("zod").ZodString;
|
|
216
|
+
clientSecretEnv: import("zod").ZodOptional<import("zod").ZodString>;
|
|
217
|
+
clientAuth: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
218
|
+
body: "body";
|
|
219
|
+
basic: "basic";
|
|
220
|
+
}>>;
|
|
221
|
+
scopes: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
222
|
+
authorizeParams: import("zod").ZodDefault<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
223
|
+
allowedDomains: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
224
|
+
allowedEmails: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodEmail>>>;
|
|
225
|
+
requireHostedDomain: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
226
|
+
createAccounts: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
227
|
+
}, import("zod/v4/core").$strict>, import("zod").ZodTransform<{
|
|
228
|
+
requireHostedDomain: boolean;
|
|
229
|
+
id: string;
|
|
230
|
+
name: string;
|
|
231
|
+
issuer: string;
|
|
232
|
+
clientIdEnv: string;
|
|
233
|
+
clientAuth: "body" | "basic";
|
|
234
|
+
scopes: string[];
|
|
235
|
+
authorizeParams: Record<string, string>;
|
|
236
|
+
allowedDomains: string[];
|
|
237
|
+
allowedEmails: string[];
|
|
238
|
+
createAccounts: boolean;
|
|
239
|
+
clientSecretEnv?: string | undefined;
|
|
240
|
+
}, {
|
|
241
|
+
id: string;
|
|
242
|
+
name: string;
|
|
243
|
+
issuer: string;
|
|
244
|
+
clientIdEnv: string;
|
|
245
|
+
clientAuth: "body" | "basic";
|
|
246
|
+
scopes: string[];
|
|
247
|
+
authorizeParams: Record<string, string>;
|
|
248
|
+
allowedDomains: string[];
|
|
249
|
+
allowedEmails: string[];
|
|
250
|
+
createAccounts: boolean;
|
|
251
|
+
clientSecretEnv?: string | undefined;
|
|
252
|
+
requireHostedDomain?: boolean | undefined;
|
|
253
|
+
}>>>>;
|
|
254
|
+
stateTtlMinutes: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
255
|
+
httpTimeoutMs: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
256
|
+
fetch: import("zod").ZodOptional<import("zod").ZodCustom<import("@softure-ai/core").FetchFunction, import("@softure-ai/core").FetchFunction>>;
|
|
257
|
+
}, import("zod/v4/core").$strict>>;
|
|
190
258
|
onRegistered: import("zod").ZodOptional<import("zod").ZodCustom<import("./options.js").OnRegisteredHook, import("./options.js").OnRegisteredHook>>;
|
|
191
259
|
rewriteRedirect: import("zod").ZodOptional<import("zod").ZodCustom<import("./options.js").RewriteRedirect, import("./options.js").RewriteRedirect>>;
|
|
192
260
|
}, import("zod/v4/core").$strict>>;
|
|
193
261
|
export { INITIAL_AUTH_FORM_STATE } from "./contract.js";
|
|
194
|
-
export type { AuthErrorCode, AuthFormErrorCode, AuthFormField, AuthFormState, AuthUser, NewSession, RegisteredEvent, SignedIn, } from "./contract.js";
|
|
262
|
+
export type { AuthErrorCode, AuthFormErrorCode, AuthFormField, AuthFormState, AuthUser, NewSession, OidcSignInErrorCode, RegisteredEvent, SignedIn, } from "./contract.js";
|
|
195
263
|
export { authMessages, getAuthErrorMessage, type AuthMessages } from "./messages/index.js";
|
|
196
|
-
export type
|
|
264
|
+
export { OIDC_PROVIDER_ID_PATTERN, type AuthOptions, type AuthOptionsInput, type OidcProvider, type OidcProviderInput, type OnRegisteredHook, type RewriteRedirect, type RewriteRedirectContext, type ScryptParams, } from "./options.js";
|
|
197
265
|
export { consolePasswordResetSender, type PasswordResetDetails, type PasswordResetEnqueuer, type PasswordResetSender, } from "./password-reset-sender.js";
|
|
198
266
|
export { getSessionCookie, type SessionCookie } from "./session-cookie.js";
|
|
199
267
|
export { toSafeNextPath } from "./safe-next-path.js";
|
|
200
268
|
export { ADMIN_ROLE, ROLE_NAME_PATTERN } from "./roles.js";
|
|
201
|
-
export { passwordResets, sessions, userRoles, users } from "./schema.js";
|
|
269
|
+
export { identities, oidcStates, passwordResets, sessions, userRoles, users } from "./schema.js";
|
|
202
270
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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
|
|
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,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
|
@@ -18,7 +18,8 @@ export const REGISTRATION_CLOSED_ENV = "SOFTURE_SWITCH_AUTH_REGISTRATION_CLOSED"
|
|
|
18
18
|
* Rate limit buckets auth consumes, with defaults to spread into `security({ buckets })`:
|
|
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
23
|
*/
|
|
23
24
|
export const AUTH_RATE_LIMIT_BUCKETS = {
|
|
24
25
|
register: { limit: 5, windowMinutes: 15, key: "ip" },
|
|
@@ -28,6 +29,8 @@ export const AUTH_RATE_LIMIT_BUCKETS = {
|
|
|
28
29
|
"password-reset": { limit: 10, windowMinutes: 15, key: "ip" },
|
|
29
30
|
"password-reset-account": { limit: 3, windowMinutes: 15, key: "account" },
|
|
30
31
|
"password-reset-confirm": { limit: 10, windowMinutes: 15, key: "ip" },
|
|
32
|
+
"oidc-start": { limit: 20, windowMinutes: 15, key: "ip" },
|
|
33
|
+
"oidc-callback": { limit: 20, windowMinutes: 15, key: "ip" },
|
|
31
34
|
};
|
|
32
35
|
/**
|
|
33
36
|
* Enables accounts in `softure.config.ts` (next to `security({ ... })`):
|
|
@@ -36,10 +39,10 @@ export const AUTH_RATE_LIMIT_BUCKETS = {
|
|
|
36
39
|
export const auth = defineModule({
|
|
37
40
|
manifest: {
|
|
38
41
|
id: MODULE_ID,
|
|
39
|
-
version: "0.2.
|
|
42
|
+
version: "0.2.7",
|
|
40
43
|
dependsOn: { security: "^0.2.0", mailing: "^0.2.0?", ops: "^0.2.0?", jobs: "^0.1.1?" },
|
|
41
44
|
dbSchema: "auth",
|
|
42
|
-
tables: ["users", "sessions", "user_roles", "password_resets"],
|
|
45
|
+
tables: ["users", "sessions", "user_roles", "password_resets", "identities", "oidc_states"],
|
|
43
46
|
env: [
|
|
44
47
|
{
|
|
45
48
|
name: REGISTRATION_CLOSED_ENV,
|
|
@@ -64,6 +67,7 @@ export const auth = defineModule({
|
|
|
64
67
|
{ kind: "page", path: "app/forgot-password/page.tsx", export: "ForgotPasswordPage" },
|
|
65
68
|
{ kind: "page", path: "app/reset-password/page.tsx", export: "ResetPasswordPage" },
|
|
66
69
|
{ kind: "route-handler", path: "app/api/auth/session/route.ts", export: "getSessionRoute" },
|
|
70
|
+
{ kind: "route-handler", path: "app/api/auth/oidc/[provider]/callback/route.ts", export: "oidcCallbackRoute" },
|
|
67
71
|
{ kind: "middleware", path: "proxy.ts", export: "createAuthGuard" },
|
|
68
72
|
],
|
|
69
73
|
privacy: { exports: true, deletes: true },
|
|
@@ -76,9 +80,10 @@ export const auth = defineModule({
|
|
|
76
80
|
});
|
|
77
81
|
export { INITIAL_AUTH_FORM_STATE } from "./contract.js";
|
|
78
82
|
export { authMessages, getAuthErrorMessage } from "./messages/index.js";
|
|
83
|
+
export { OIDC_PROVIDER_ID_PATTERN, } from "./options.js";
|
|
79
84
|
export { consolePasswordResetSender, } from "./password-reset-sender.js";
|
|
80
85
|
export { getSessionCookie } from "./session-cookie.js";
|
|
81
86
|
export { toSafeNextPath } from "./safe-next-path.js";
|
|
82
87
|
export { ADMIN_ROLE, ROLE_NAME_PATTERN } from "./roles.js";
|
|
83
|
-
export { passwordResets, sessions, userRoles, users } from "./schema.js";
|
|
88
|
+
export { identities, oidcStates, passwordResets, sessions, userRoles, users } from "./schema.js";
|
|
84
89
|
//# sourceMappingURL=index.js.map
|
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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,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/messages/en.d.ts
CHANGED
|
@@ -69,6 +69,12 @@ export declare const en: {
|
|
|
69
69
|
logout: {
|
|
70
70
|
submit: string;
|
|
71
71
|
};
|
|
72
|
+
oidc: {
|
|
73
|
+
/** The button of an OpenID Connect provider; `{provider}` is its `name` (e.g. Google). */
|
|
74
|
+
signInWith: string;
|
|
75
|
+
/** Between the provider buttons and the password form. */
|
|
76
|
+
divider: string;
|
|
77
|
+
};
|
|
72
78
|
errors: {
|
|
73
79
|
auth: {
|
|
74
80
|
invalid_credentials: string;
|
|
@@ -84,6 +90,10 @@ export declare const en: {
|
|
|
84
90
|
forbidden: string;
|
|
85
91
|
reset_token_invalid: string;
|
|
86
92
|
password_reset_unavailable: string;
|
|
93
|
+
oidc_failed: string;
|
|
94
|
+
oidc_cancelled: string;
|
|
95
|
+
oidc_not_allowed: string;
|
|
96
|
+
oidc_no_account: string;
|
|
87
97
|
};
|
|
88
98
|
security: {
|
|
89
99
|
rate_limited: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/messages/en.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA2DX,qFAAqF
|
|
1
|
+
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/messages/en.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA2DX,qFAAqF;;;;;;;;;;;;;QAQrF,0FAA0F;;QAE1F,0DAA0D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgC7D,CAAC"}
|
package/dist/messages/en.js
CHANGED
|
@@ -64,6 +64,12 @@ export const en = {
|
|
|
64
64
|
logout: {
|
|
65
65
|
submit: "Log out",
|
|
66
66
|
},
|
|
67
|
+
oidc: {
|
|
68
|
+
/** The button of an OpenID Connect provider; `{provider}` is its `name` (e.g. Google). */
|
|
69
|
+
signInWith: "Sign in with {provider}",
|
|
70
|
+
/** Between the provider buttons and the password form. */
|
|
71
|
+
divider: "or",
|
|
72
|
+
},
|
|
67
73
|
errors: {
|
|
68
74
|
auth: {
|
|
69
75
|
invalid_credentials: "The email or password is incorrect.",
|
|
@@ -79,6 +85,10 @@ export const en = {
|
|
|
79
85
|
forbidden: "You do not have access to this.",
|
|
80
86
|
reset_token_invalid: "This link has expired or has already been used. Ask for a new one.",
|
|
81
87
|
password_reset_unavailable: "Password reset is not available.",
|
|
88
|
+
oidc_failed: "Signing in did not work. Try again.",
|
|
89
|
+
oidc_cancelled: "Signing in was cancelled.",
|
|
90
|
+
oidc_not_allowed: "This account may not sign in here.",
|
|
91
|
+
oidc_no_account: "There is no account for this sign-in. Ask for access.",
|
|
82
92
|
},
|
|
83
93
|
security: {
|
|
84
94
|
rate_limited: "Too many attempts. Wait a few minutes and try again.",
|
package/dist/messages/en.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en.js","sourceRoot":"","sources":["../../src/messages/en.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,EAAE,GAAG;IAChB,MAAM,EAAE;QACN,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,UAAU;QACpB,eAAe,EAAE,kBAAkB;QACnC,WAAW,EAAE,cAAc;QAC3B,eAAe,EAAE,kCAAkC;QACnD,OAAO,EAAE,uDAAuD;KACjE;IACD,KAAK,EAAE;QACL,KAAK,EAA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