@owlmeans/web-auth 0.1.18-rc.13 → 0.1.18-rc.14

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.
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 2,
3
3
  "package": "@owlmeans/web-auth",
4
- "version": "0.1.18-rc.12",
5
- "generatedAt": "2026-08-27T21:16:47.137Z",
4
+ "version": "0.1.18-rc.13",
5
+ "generatedAt": "2026-08-27T21:18:31.380Z",
6
6
  "canonicalRepo": "https://github.com/owlmeans/common",
7
7
  "entries": [
8
8
  {
@@ -8,7 +8,7 @@ user-invocable: false
8
8
  # @owlmeans/web-auth
9
9
 
10
10
  **Layer:** Web
11
- **Install:** `"@owlmeans/web-auth": "^0.1.18-rc.12"` in `dependencies`
11
+ **Install:** `"@owlmeans/web-auth": "^0.1.18-rc.13"` in `dependencies`
12
12
 
13
13
  Web-side auth UI plugins that register into the shared `@owlmeans/client-auth/manager` plugin registry
14
14
  (mirrors `@owlmeans/web-oidc-rp`). Currently ships the **PK-based supervisor** login form.
package/build/append.d.ts CHANGED
@@ -1,19 +1,28 @@
1
+ import type { CommonConfig } from '@owlmeans/config';
1
2
  export interface WebSupervisorAuthOptions {
2
- /** Force enable/disable. Default: development only (cfg.debug.all || cfg.debug.supervisor). */
3
+ /** Force enable/disable. Default: `cfg.debug.supervisor === true`. */
3
4
  enabled?: boolean;
5
+ /**
6
+ * Also offer it on the sign-in screen. Defaults to true — an operator login that is registered
7
+ * but reachable only by typing its URL is a login nobody finds and an exposure nobody sees.
8
+ */
9
+ offer?: boolean;
4
10
  }
5
- /**
6
- * Unified, explicit append for the PK-based supervisor login UI. Call it once on
7
- * the web client context. Development-only by default. It registers the
8
- * supervisor client plugin so the form is rendered by the standard typed
9
- * authentication route at {@link SUPERVISOR_LOGIN_PATH}.
10
- */
11
- export declare const appendSupervisorAuth: <T extends {
11
+ interface DebugCarrier {
12
12
  cfg: {
13
13
  debug?: {
14
14
  all?: boolean;
15
15
  supervisor?: boolean;
16
16
  };
17
+ security?: CommonConfig['security'];
17
18
  };
18
- }>(context: T, opts?: WebSupervisorAuthOptions) => T;
19
+ }
20
+ /**
21
+ * Unified, explicit append for the PK-based supervisor login UI. Call it once on the web client
22
+ * context. It registers the supervisor client plugin so the form is rendered by the standard typed
23
+ * authentication route at {@link SUPERVISOR_LOGIN_PATH}, and enables it in the sign-in screen's
24
+ * configuration — which is what turns a `restricted` method from registered into offerable.
25
+ */
26
+ export declare const appendSupervisorAuth: <T extends DebugCarrier>(context: T, opts?: WebSupervisorAuthOptions) => T;
27
+ export {};
19
28
  //# sourceMappingURL=append.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"append.d.ts","sourceRoot":"","sources":["../src/append.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,wBAAwB;IACvC,+FAA+F;IAC/F,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAKD;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS;IAAE,GAAG,EAAE;QAAE,KAAK,CAAC,EAAE;YAAE,GAAG,CAAC,EAAE,OAAO,CAAC;YAAC,UAAU,CAAC,EAAE,OAAO,CAAA;SAAE,CAAA;KAAE,CAAA;CAAE,WAChG,CAAC,SAAS,wBAAwB,KAC1C,CASF,CAAA"}
1
+ {"version":3,"file":"append.d.ts","sourceRoot":"","sources":["../src/append.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAGpD,MAAM,WAAW,wBAAwB;IACvC,sEAAsE;IACtE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED,UAAU,YAAY;IACpB,GAAG,EAAE;QACH,KAAK,CAAC,EAAE;YAAE,GAAG,CAAC,EAAE,OAAO,CAAC;YAAC,UAAU,CAAC,EAAE,OAAO,CAAA;SAAE,CAAA;QAC/C,QAAQ,CAAC,EAAE,YAAY,CAAC,UAAU,CAAC,CAAA;KACpC,CAAA;CACF;AAcD;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,YAAY,WAChD,CAAC,SAAS,wBAAwB,KAC1C,CAoBF,CAAA"}
package/build/append.js CHANGED
@@ -1,19 +1,38 @@
1
1
  import { AuthenticationType } from '@owlmeans/auth';
2
2
  import { plugins as authPlugins } from '@owlmeans/client-auth/manager';
3
3
  import { supervisorClientPlugin } from './auth/plugins/supervisor.js';
4
- const isDevelopment = (context) => context.cfg.debug?.all === true || context.cfg.debug?.supervisor === true;
5
4
  /**
6
- * Unified, explicit append for the PK-based supervisor login UI. Call it once on
7
- * the web client context. Development-only by default. It registers the
8
- * supervisor client plugin so the form is rendered by the standard typed
9
- * authentication route at {@link SUPERVISOR_LOGIN_PATH}.
5
+ * Whether this deployment wants the PK supervisor login.
6
+ *
7
+ * Reads `debug.supervisor` and deliberately NOT `debug.all`. `debug.all` is set by whole families
8
+ * of applications for reasons that have nothing to do with authentication — a generated target
9
+ * application sets it for itself — so gating on it hands an operator login to every one of them,
10
+ * in production, reachable by anyone who types the URL. `debug.supervisor` is a deployment saying
11
+ * this specific thing on purpose.
12
+ */
13
+ const isSupervised = (context) => context.cfg.debug?.supervisor === true;
14
+ /**
15
+ * Unified, explicit append for the PK-based supervisor login UI. Call it once on the web client
16
+ * context. It registers the supervisor client plugin so the form is rendered by the standard typed
17
+ * authentication route at {@link SUPERVISOR_LOGIN_PATH}, and enables it in the sign-in screen's
18
+ * configuration — which is what turns a `restricted` method from registered into offerable.
10
19
  */
11
20
  export const appendSupervisorAuth = (context, opts) => {
12
- const enabled = opts?.enabled ?? isDevelopment(context);
21
+ const enabled = opts?.enabled ?? isSupervised(context);
13
22
  if (!enabled) {
14
23
  return context;
15
24
  }
16
25
  authPlugins[AuthenticationType.Supervisor] = supervisorClientPlugin;
26
+ if (opts?.offer ?? true) {
27
+ const cfg = context.cfg;
28
+ cfg.security ??= {};
29
+ cfg.security.auth ??= {};
30
+ cfg.security.auth.login ??= {};
31
+ const login = cfg.security.auth.login;
32
+ login.secretKey ??= true;
33
+ login.overrides ??= {};
34
+ login.overrides[AuthenticationType.Supervisor] ??= { enabled: true };
35
+ }
17
36
  return context;
18
37
  };
19
38
  //# sourceMappingURL=append.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"append.js","sourceRoot":"","sources":["../src/append.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,+BAA+B,CAAA;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AAOrE,MAAM,aAAa,GAAG,CAAC,OAAqE,EAAW,EAAE,CACvG,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;AAE3E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,OAAU,EAAE,IAA+B,EACxC,EAAE;IACL,MAAM,OAAO,GAAG,IAAI,EAAE,OAAO,IAAI,aAAa,CAAC,OAAO,CAAC,CAAA;IACvD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,OAAO,CAAA;IAChB,CAAC;IAED,WAAW,CAAC,kBAAkB,CAAC,UAAU,CAAC,GAAG,sBAAsB,CAAA;IAEnE,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA"}
1
+ {"version":3,"file":"append.js","sourceRoot":"","sources":["../src/append.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAEtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AAmBrE;;;;;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,CAAA"}
1
+ {"version":3,"file":"supervisor.d.ts","sourceRoot":"","sources":["../../../src/auth/plugins/supervisor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAA;AAWjF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB,EAAE,oBA2EpC,CAAA"}
@@ -20,6 +20,10 @@ import { createIdOfLength } from '@owlmeans/basic-ids';
20
20
  */
21
21
  export const supervisorClientPlugin = {
22
22
  type: AuthenticationType.Supervisor,
23
+ // `restricted`, so registering the plugin is not enough to put an operator login on the sign-in
24
+ // screen of a production application — the configuration has to name it. Last in the order and
25
+ // rendered as a link, because it is a tool, not a way in.
26
+ method: { order: 900, icon: 'key', emphasis: 'link', restricted: true },
23
27
  Implementation: () => ({ type, control }) => {
24
28
  const context = useContext();
25
29
  const [userId, setUserId] = useState('');
@@ -1 +1 @@
1
- {"version":3,"file":"supervisor.js","sourceRoot":"","sources":["../../../src/auth/plugins/supervisor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAGhC,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAE3E,OAAO,EAAE,aAAa,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAErE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAE3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEtD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAyB;IAC1D,IAAI,EAAE,kBAAkB,CAAC,UAAU;IAEnC,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;QAC1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A;IACtB,CAAC;CACF,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owlmeans/web-auth",
3
- "version": "0.1.18-rc.13",
3
+ "version": "0.1.18-rc.14",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -29,21 +29,22 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@owlmeans/auth": "^0.1.18-rc.6",
33
- "@owlmeans/auth-common": "^0.1.18-rc.8",
34
- "@owlmeans/basic-ids": "^0.1.18-rc.6",
35
- "@owlmeans/basic-keys": "^0.1.18-rc.8",
36
- "@owlmeans/client": "^0.1.18-rc.9",
37
- "@owlmeans/client-auth": "^0.1.18-rc.12",
32
+ "@owlmeans/auth": "^0.1.18-rc.7",
33
+ "@owlmeans/auth-common": "^0.1.18-rc.9",
34
+ "@owlmeans/basic-ids": "^0.1.18-rc.7",
35
+ "@owlmeans/basic-keys": "^0.1.18-rc.9",
36
+ "@owlmeans/client": "^0.1.18-rc.10",
37
+ "@owlmeans/client-auth": "^0.1.18-rc.13",
38
+ "@owlmeans/config": "^0.1.18-rc.8",
38
39
  "@owlmeans/context": "^0.1.18-rc.6",
39
- "@owlmeans/web-client": "^0.1.18-rc.13"
40
+ "@owlmeans/web-client": "^0.1.18-rc.14"
40
41
  },
41
42
  "peerDependencies": {
42
43
  "react": "*"
43
44
  },
44
45
  "devDependencies": {
45
46
  "@owlmeans/dep-config": "workspace:*",
46
- "@types/bun": "^1.3.14",
47
+ "@types/bun": "^1.4.0",
47
48
  "@types/react": "^19.2.17",
48
49
  "nodemon": "^3.1.14",
49
50
  "typescript": "^7.0.2"
package/src/append.ts CHANGED
@@ -1,30 +1,63 @@
1
1
  import { AuthenticationType } from '@owlmeans/auth'
2
2
  import { plugins as authPlugins } from '@owlmeans/client-auth/manager'
3
+ import type { CommonConfig } from '@owlmeans/config'
3
4
  import { supervisorClientPlugin } from './auth/plugins/supervisor.js'
4
5
 
5
6
  export interface WebSupervisorAuthOptions {
6
- /** Force enable/disable. Default: development only (cfg.debug.all || cfg.debug.supervisor). */
7
+ /** Force enable/disable. Default: `cfg.debug.supervisor === true`. */
7
8
  enabled?: boolean
9
+ /**
10
+ * Also offer it on the sign-in screen. Defaults to true — an operator login that is registered
11
+ * but reachable only by typing its URL is a login nobody finds and an exposure nobody sees.
12
+ */
13
+ offer?: boolean
8
14
  }
9
15
 
10
- const isDevelopment = (context: { cfg: { debug?: { all?: boolean, supervisor?: boolean } } }): boolean =>
11
- context.cfg.debug?.all === true || context.cfg.debug?.supervisor === true
16
+ interface DebugCarrier {
17
+ cfg: {
18
+ debug?: { all?: boolean, supervisor?: boolean }
19
+ security?: CommonConfig['security']
20
+ }
21
+ }
12
22
 
13
23
  /**
14
- * Unified, explicit append for the PK-based supervisor login UI. Call it once on
15
- * the web client context. Development-only by default. It registers the
16
- * supervisor client plugin so the form is rendered by the standard typed
17
- * authentication route at {@link SUPERVISOR_LOGIN_PATH}.
24
+ * Whether this deployment wants the PK supervisor login.
25
+ *
26
+ * Reads `debug.supervisor` and deliberately NOT `debug.all`. `debug.all` is set by whole families
27
+ * of applications for reasons that have nothing to do with authentication — a generated target
28
+ * application sets it for itself — so gating on it hands an operator login to every one of them,
29
+ * in production, reachable by anyone who types the URL. `debug.supervisor` is a deployment saying
30
+ * this specific thing on purpose.
18
31
  */
19
- export const appendSupervisorAuth = <T extends { cfg: { debug?: { all?: boolean, supervisor?: boolean } } }>(
32
+ const isSupervised = (context: DebugCarrier): boolean =>
33
+ context.cfg.debug?.supervisor === true
34
+
35
+ /**
36
+ * Unified, explicit append for the PK-based supervisor login UI. Call it once on the web client
37
+ * context. It registers the supervisor client plugin so the form is rendered by the standard typed
38
+ * authentication route at {@link SUPERVISOR_LOGIN_PATH}, and enables it in the sign-in screen's
39
+ * configuration — which is what turns a `restricted` method from registered into offerable.
40
+ */
41
+ export const appendSupervisorAuth = <T extends DebugCarrier>(
20
42
  context: T, opts?: WebSupervisorAuthOptions
21
43
  ): T => {
22
- const enabled = opts?.enabled ?? isDevelopment(context)
44
+ const enabled = opts?.enabled ?? isSupervised(context)
23
45
  if (!enabled) {
24
46
  return context
25
47
  }
26
48
 
27
49
  authPlugins[AuthenticationType.Supervisor] = supervisorClientPlugin
28
50
 
51
+ if (opts?.offer ?? true) {
52
+ const cfg = context.cfg as CommonConfig
53
+ cfg.security ??= {}
54
+ cfg.security.auth ??= {}
55
+ cfg.security.auth.login ??= {}
56
+ const login = cfg.security.auth.login
57
+ login.secretKey ??= true
58
+ login.overrides ??= {}
59
+ login.overrides[AuthenticationType.Supervisor] ??= { enabled: true }
60
+ }
61
+
29
62
  return context
30
63
  }
@@ -26,6 +26,11 @@ import { createIdOfLength } from '@owlmeans/basic-ids'
26
26
  export const supervisorClientPlugin: AuthenticationPlugin = {
27
27
  type: AuthenticationType.Supervisor,
28
28
 
29
+ // `restricted`, so registering the plugin is not enough to put an operator login on the sign-in
30
+ // screen of a production application — the configuration has to name it. Last in the order and
31
+ // rendered as a link, because it is a tool, not a way in.
32
+ method: { order: 900, icon: 'key', emphasis: 'link', restricted: true },
33
+
29
34
  Implementation: () => ({ type, control }) => {
30
35
  const context = useContext()
31
36
  const [userId, setUserId] = useState('')