@softure-ai/auth 0.2.7 → 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.
- package/CHANGELOG.md +19 -2
- package/README.md +15 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/module.json +1 -1
- package/package.json +1 -1
- package/src/index.ts +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,21 @@ 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
|
+
|
|
7
22
|
## 0.2.7
|
|
8
23
|
|
|
9
24
|
- `AuthMessages`: the OpenID Connect keys (`oidc`, `errors.auth.oidc_failed`, `oidc_cancelled`, `oidc_not_allowed`,
|
|
@@ -27,8 +42,10 @@ Migration for an app: run `softure migrate` (migration `0006`). To show the sign
|
|
|
27
42
|
|
|
28
43
|
## 0.2.6
|
|
29
44
|
|
|
30
|
-
Sign in with an OpenID Connect provider (Google), limited to allowed domains or emails (#769).
|
|
31
|
-
`oidc`
|
|
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.
|
|
32
49
|
|
|
33
50
|
- `auth({ oidc: { providers: [{ id, name, issuer, clientIdEnv, clientSecretEnv, allowedDomains, allowedEmails,
|
|
34
51
|
createAccounts, ... }] } })`: authorization code flow with PKCE S256, a one-time state bound to the browser by a
|
package/README.md
CHANGED
|
@@ -201,6 +201,21 @@ the variables the provider names.
|
|
|
201
201
|
`oidc.fetch` and `fake.env` as the context's `env`; `fake.signIn(authorizeUrl, { subject, email, hostedDomain, name, givenName })`
|
|
202
202
|
answers the callback URL. It can break on purpose (`claims`, `signWith`, `rotateKeys`, `failNext`, `setDiscovery`).
|
|
203
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
|
+
|
|
204
219
|
## 4. Mounting
|
|
205
220
|
|
|
206
221
|
One line per file, owned by the app (docs/02 §8):
|
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: {
|
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":"AAU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c,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.
|
|
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;AACt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;IAC/B,MAAM,EAAE,eAAe;CACxB,CAAC,CAAC;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAYxD,OAAO,EAAE,YAAY,EAAE,mBAAmB,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"}
|
package/module.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "auth",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"dependsOn": { "security": "^0.2.0", "mailing": "^0.2.0?", "ops": "^0.2.0?", "jobs": "^0.1.1?" },
|
|
5
5
|
"dbSchema": "auth",
|
|
6
6
|
"tables": ["users", "sessions", "user_roles", "password_resets", "identities", "oidc_states"],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softure-ai/auth",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "SOFTURE AI auth module: users, scrypt passwords, database sessions, register with consent, login, logout, password change, roles, a proxy route guard, pages and forms for Next.js, and a password reset sender over @softure-ai/mailing, sent in the request or by a background job through @softure-ai/jobs.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
package/src/index.ts
CHANGED
|
@@ -24,7 +24,8 @@ export const REGISTRATION_CLOSED_ENV = "SOFTURE_SWITCH_AUTH_REGISTRATION_CLOSED"
|
|
|
24
24
|
* `register` and `login` per client address, `login-account` per email, `change-password` per user,
|
|
25
25
|
* `password-reset` (link requests) and `password-reset-confirm` (new passwords) per client address,
|
|
26
26
|
* `password-reset-account` per email, which bounds the mails one address can receive, and `oidc-start` and
|
|
27
|
-
* `oidc-callback` (OpenID Connect sign-ins started and completed) per client address.
|
|
27
|
+
* `oidc-callback` (OpenID Connect sign-ins started and completed) per client address. The `oidc-*` buckets are
|
|
28
|
+
* required only with a provider and count nothing without one, so an app without OpenID Connect may leave them out.
|
|
28
29
|
*/
|
|
29
30
|
export const AUTH_RATE_LIMIT_BUCKETS = {
|
|
30
31
|
register: { limit: 5, windowMinutes: 15, key: "ip" },
|
|
@@ -45,7 +46,7 @@ export const AUTH_RATE_LIMIT_BUCKETS = {
|
|
|
45
46
|
export const auth = defineModule({
|
|
46
47
|
manifest: {
|
|
47
48
|
id: MODULE_ID,
|
|
48
|
-
version: "0.2.
|
|
49
|
+
version: "0.2.8",
|
|
49
50
|
dependsOn: { security: "^0.2.0", mailing: "^0.2.0?", ops: "^0.2.0?", jobs: "^0.1.1?" },
|
|
50
51
|
dbSchema: "auth",
|
|
51
52
|
tables: ["users", "sessions", "user_roles", "password_resets", "identities", "oidc_states"],
|