@jskit-ai/auth-core 0.2.10 → 0.2.11
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
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
- `normalizeAuthCapabilities` carries `features.password.selfRegister`: whether anyone may register, not only an invited person or the first account. A provider that doesn't say gets the value of `register`.
|
|
5
6
|
- The register body takes `setupCode`, the first account's one-time setup code, and the capability `features.firstAccountSetupCode` says a provider is waiting for it. New message key: `jskit.auth.validation.setupCodeInvalid`.
|
|
6
7
|
- Registration confirmation: the action and command `auth.register.confirm` (`POST /api/register/confirm`, body `{ token }`, answer `{ ok, email, username, message }` with a message code) confirm a registration's email from the code in its link, and `authApi.confirmRegistration()` calls it. `AuthService.confirmRegistration(input)` creates the waiting account and its session; a provider without it answers `AUTH_OPERATION_UNSUPPORTED`. The capability `features.emailConfirmationCode` says the provider takes a code that way. The register and resend answers may carry `confirmationUrl`, the link itself in development. New message keys: `jskit.auth.login.emailUnconfirmed` (refused sign-in, status 403) and `jskit.auth.validation.confirmationCodeRequired`.
|
|
7
8
|
- The dev auth policy and the CSRF cookie's default decide production with the kernel's `isProductionEnv`, the check every JSKIT package now shares; what counts as production is unchanged. `./server/devAuth` no longer exports `isProductionNodeEnv(nodeEnv)`: call `isProductionEnv(env)` from `@jskit-ai/kernel/server/runtime/runtimeMode` instead.
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jskit-ai/auth-core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"test": "
|
|
6
|
+
"test": "jskit test"
|
|
7
7
|
},
|
|
8
8
|
"exports": {
|
|
9
9
|
"./server/providers/AuthAccessProvider": "./src/server/providers/AuthAccessProvider.js",
|
|
@@ -143,6 +143,6 @@
|
|
|
143
143
|
}
|
|
144
144
|
},
|
|
145
145
|
"peerDependencies": {
|
|
146
|
-
"@jskit-ai/kernel": "0.2.
|
|
146
|
+
"@jskit-ai/kernel": "0.2.11"
|
|
147
147
|
}
|
|
148
148
|
}
|
|
@@ -122,6 +122,9 @@ function normalizeAuthCapabilities(value = {}) {
|
|
|
122
122
|
password: Object.freeze({
|
|
123
123
|
login: normalizeBoolean(passwordSource.login),
|
|
124
124
|
register: normalizeBoolean(passwordSource.register),
|
|
125
|
+
// Anyone may register, not only an invited person or the first account; a provider that says nothing means
|
|
126
|
+
// whatever register says.
|
|
127
|
+
selfRegister: normalizeBoolean(passwordSource.selfRegister, normalizeBoolean(passwordSource.register)),
|
|
125
128
|
change: normalizeBoolean(passwordSource.change),
|
|
126
129
|
methodToggle: normalizeBoolean(passwordSource.methodToggle)
|
|
127
130
|
}),
|
|
@@ -286,6 +286,7 @@ const authCapabilityProviderOutputSchema = createSchema({
|
|
|
286
286
|
const authPasswordCapabilitiesOutputSchema = createSchema({
|
|
287
287
|
login: { type: "boolean", required: true },
|
|
288
288
|
register: { type: "boolean", required: true },
|
|
289
|
+
selfRegister: { type: "boolean", required: true },
|
|
289
290
|
change: { type: "boolean", required: true },
|
|
290
291
|
methodToggle: { type: "boolean", required: true }
|
|
291
292
|
});
|
|
@@ -56,6 +56,13 @@ test("normalizeAuthCapabilities returns one provider-neutral feature shape", ()
|
|
|
56
56
|
assert.equal(capabilities.provider.label, "Local");
|
|
57
57
|
assert.equal(capabilities.features.password.login, true);
|
|
58
58
|
assert.equal(capabilities.features.password.methodToggle, false);
|
|
59
|
+
// Self-registration follows register unless the provider says otherwise.
|
|
60
|
+
assert.equal(capabilities.features.password.selfRegister, true);
|
|
61
|
+
assert.equal(
|
|
62
|
+
normalizeAuthCapabilities({ features: { password: { register: true, selfRegister: false } } }).features.password.selfRegister,
|
|
63
|
+
false
|
|
64
|
+
);
|
|
65
|
+
assert.equal(normalizeAuthCapabilities({ features: { password: { selfRegister: true } } }).features.password.selfRegister, true);
|
|
59
66
|
assert.equal(capabilities.features.passwordRecovery.delivery, "email");
|
|
60
67
|
assert.deepEqual(capabilities.features.oauthLogin.providers, [
|
|
61
68
|
{ id: "google", label: "Google" },
|