@owlmeans/client-auth 0.1.18-rc.2 → 0.1.18-rc.21
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/README.md +6 -6
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/client-auth/SKILL.md +134 -21
- package/build/components/dispatcher/component.js +1 -1
- package/build/components/dispatcher/component.js.map +1 -1
- package/build/{modules.d.ts → entrypoints.d.ts} +2 -2
- package/build/entrypoints.d.ts.map +1 -0
- package/build/{modules.js → entrypoints.js} +3 -3
- package/build/entrypoints.js.map +1 -0
- package/build/helper.js +1 -1
- package/build/helper.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/login/adopt.d.ts +24 -0
- package/build/login/adopt.d.ts.map +1 -0
- package/build/login/adopt.js +28 -0
- package/build/login/adopt.js.map +1 -0
- package/build/login/consts.d.ts +57 -0
- package/build/login/consts.d.ts.map +1 -0
- package/build/login/consts.js +57 -0
- package/build/login/consts.js.map +1 -0
- package/build/login/credit.d.ts +24 -0
- package/build/login/credit.d.ts.map +1 -0
- package/build/login/credit.js +58 -0
- package/build/login/credit.js.map +1 -0
- package/build/login/env.d.ts +32 -0
- package/build/login/env.d.ts.map +1 -0
- package/build/login/env.js +84 -0
- package/build/login/env.js.map +1 -0
- package/build/login/flow.d.ts +20 -0
- package/build/login/flow.d.ts.map +1 -0
- package/build/login/flow.js +39 -0
- package/build/login/flow.js.map +1 -0
- package/build/login/hook.d.ts +37 -0
- package/build/login/hook.d.ts.map +1 -0
- package/build/login/hook.js +72 -0
- package/build/login/hook.js.map +1 -0
- package/build/login/i18n/be.json +37 -0
- package/build/login/i18n/de.json +37 -0
- package/build/login/i18n/en.json +37 -0
- package/build/login/i18n/es.json +37 -0
- package/build/login/i18n/pl.json +37 -0
- package/build/login/i18n/ru.json +37 -0
- package/build/login/i18n/uk.json +37 -0
- package/build/login/i18n.d.ts +2 -0
- package/build/login/i18n.d.ts.map +1 -0
- package/build/login/i18n.js +25 -0
- package/build/login/i18n.js.map +1 -0
- package/build/login/index.d.ts +15 -0
- package/build/login/index.d.ts.map +1 -0
- package/build/login/index.js +15 -0
- package/build/login/index.js.map +1 -0
- package/build/login/methods.d.ts +25 -0
- package/build/login/methods.d.ts.map +1 -0
- package/build/login/methods.js +97 -0
- package/build/login/methods.js.map +1 -0
- package/build/login/resume.d.ts +30 -0
- package/build/login/resume.d.ts.map +1 -0
- package/build/login/resume.js +55 -0
- package/build/login/resume.js.map +1 -0
- package/build/login/screen.d.ts +17 -0
- package/build/login/screen.d.ts.map +1 -0
- package/build/login/screen.js +76 -0
- package/build/login/screen.js.map +1 -0
- package/build/login/service.d.ts +31 -0
- package/build/login/service.d.ts.map +1 -0
- package/build/login/service.js +137 -0
- package/build/login/service.js.map +1 -0
- package/build/login/surrogate.d.ts +20 -0
- package/build/login/surrogate.d.ts.map +1 -0
- package/build/login/surrogate.js +33 -0
- package/build/login/surrogate.js.map +1 -0
- package/build/login/terms.d.ts +20 -0
- package/build/login/terms.d.ts.map +1 -0
- package/build/login/terms.js +0 -0
- package/build/login/terms.js.map +1 -0
- package/build/login/types.d.ts +236 -0
- package/build/login/types.d.ts.map +1 -0
- package/build/login/types.js +23 -0
- package/build/login/types.js.map +1 -0
- package/build/manager/components/authentication/control.js +3 -3
- package/build/manager/components/authentication/control.js.map +1 -1
- package/build/manager/components/authentication/types.d.ts +2 -2
- package/build/manager/components/authentication/types.d.ts.map +1 -1
- package/build/manager/components/tunnel-consumer.js +2 -2
- package/build/manager/components/tunnel-consumer.js.map +1 -1
- package/build/manager/entrypoints.d.ts +2 -0
- package/build/manager/entrypoints.d.ts.map +1 -0
- package/build/manager/{modules.js → entrypoints.js} +4 -4
- package/build/manager/entrypoints.js.map +1 -0
- package/build/manager/plugins/basic-ed25519.d.ts.map +1 -1
- package/build/manager/plugins/basic-ed25519.js +5 -0
- package/build/manager/plugins/basic-ed25519.js.map +1 -1
- package/build/manager/plugins/exports.d.ts +2 -0
- package/build/manager/plugins/exports.d.ts.map +1 -1
- package/build/manager/plugins/exports.js +2 -0
- package/build/manager/plugins/exports.js.map +1 -1
- package/build/manager/plugins/index.d.ts +1 -5
- package/build/manager/plugins/index.d.ts.map +1 -1
- package/build/manager/plugins/index.js +9 -1
- package/build/manager/plugins/index.js.map +1 -1
- package/build/manager/plugins/methods.d.ts +6 -0
- package/build/manager/plugins/methods.d.ts.map +1 -0
- package/build/manager/plugins/methods.js +65 -0
- package/build/manager/plugins/methods.js.map +1 -0
- package/build/manager/plugins/re-captcha.d.ts.map +1 -1
- package/build/manager/plugins/re-captcha.js +5 -0
- package/build/manager/plugins/re-captcha.js.map +1 -1
- package/build/manager/plugins/registry.d.ts +20 -0
- package/build/manager/plugins/registry.d.ts.map +1 -0
- package/build/manager/plugins/registry.js +19 -0
- package/build/manager/plugins/registry.js.map +1 -0
- package/build/manager/plugins/tunnel-consumer.d.ts.map +1 -1
- package/build/manager/plugins/tunnel-consumer.js +4 -0
- package/build/manager/plugins/tunnel-consumer.js.map +1 -1
- package/build/manager/plugins/types.d.ts +53 -0
- package/build/manager/plugins/types.d.ts.map +1 -1
- package/build/service.js +1 -1
- package/build/service.js.map +1 -1
- package/package.json +36 -27
- package/src/components/dispatcher/component.tsx +1 -1
- package/src/{modules.ts → entrypoints.ts} +2 -2
- package/src/helper.ts +1 -1
- package/src/index.ts +1 -1
- package/src/login/adopt.ts +31 -0
- package/src/login/consts.ts +70 -0
- package/src/login/credit.ts +75 -0
- package/src/login/env.ts +86 -0
- package/src/login/flow.ts +44 -0
- package/src/login/hook.ts +80 -0
- package/src/login/i18n/be.json +37 -0
- package/src/login/i18n/de.json +37 -0
- package/src/login/i18n/en.json +37 -0
- package/src/login/i18n/es.json +37 -0
- package/src/login/i18n/pl.json +37 -0
- package/src/login/i18n/ru.json +37 -0
- package/src/login/i18n/uk.json +37 -0
- package/src/login/i18n.ts +26 -0
- package/src/login/index.ts +15 -0
- package/src/login/methods.ts +113 -0
- package/src/login/resume.ts +56 -0
- package/src/login/screen.tsx +136 -0
- package/src/login/service.ts +181 -0
- package/src/login/surrogate.ts +45 -0
- package/src/login/terms.ts +0 -0
- package/src/login/types.ts +258 -0
- package/src/manager/README.md +1 -1
- package/src/manager/components/authentication/control.ts +3 -3
- package/src/manager/components/authentication/types.ts +2 -2
- package/src/manager/components/tunnel-consumer.tsx +2 -2
- package/src/manager/{modules.ts → entrypoints.ts} +3 -3
- package/src/manager/plugins/basic-ed25519.tsx +7 -0
- package/src/manager/plugins/exports.ts +2 -0
- package/src/manager/plugins/index.ts +10 -4
- package/src/manager/plugins/methods.ts +74 -0
- package/src/manager/plugins/re-captcha.tsx +7 -0
- package/src/manager/plugins/registry.ts +26 -0
- package/src/manager/plugins/tunnel-consumer.tsx +6 -0
- package/src/manager/plugins/types.ts +54 -0
- package/src/service.ts +1 -1
- package/tests/context.ts +1 -2
- package/tests/login.spec.ts +313 -0
- package/build/.gitkeep +0 -0
- package/build/manager/modules.d.ts +0 -2
- package/build/manager/modules.d.ts.map +0 -1
- package/build/manager/modules.js.map +0 -1
- package/build/modules.d.ts.map +0 -1
- package/build/modules.js.map +0 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { LoginMethodSource } from '../../login/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Every registered authentication plugin that declares itself offerable, as a sign-in method.
|
|
4
|
+
*/
|
|
5
|
+
export declare const pluginMethodSource: LoginMethodSource;
|
|
6
|
+
//# sourceMappingURL=methods.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods.d.ts","sourceRoot":"","sources":["../../../src/manager/plugins/methods.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAmC,iBAAiB,EAAgB,MAAM,sBAAsB,CAAA;AA6B5G;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,iBAsChC,CAAA"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { CAUTHEN_AUTHEN_TYPED } from '@owlmeans/auth';
|
|
2
|
+
import { DEFAULT_METHOD_ORDER, LOGIN_SERVICE } from '../../login/consts.js';
|
|
3
|
+
import { listAuthPlugins } from './registry.js';
|
|
4
|
+
/**
|
|
5
|
+
* Whether a registered plugin may be put on the sign-in screen of THIS application.
|
|
6
|
+
*
|
|
7
|
+
* The registry is global and is filled by side-effect imports, so "registered" means only that
|
|
8
|
+
* some module was pulled into the bundle — three separate reasons why that is not enough:
|
|
9
|
+
*
|
|
10
|
+
* 1. No `method`: `re-captcha` is a STEP inside another flow, not a way to sign in.
|
|
11
|
+
* 2. No renderer: a plugin that declares `requiresRenderer` throws the moment its screen mounts
|
|
12
|
+
* unless a UI package (`web-panel`, `mui-panel`) assigned one. An app that imported the plugin
|
|
13
|
+
* host without that package would be offering buttons whose only outcome is a broken page.
|
|
14
|
+
* 3. Not wired: a plugin whose flow needs a service its context never appended fails on the
|
|
15
|
+
* lookup instead. Packages register their plugins in groups, so an app that wanted one of them
|
|
16
|
+
* gets the rest too, and the rest have to be able to say they do not apply here.
|
|
17
|
+
*/
|
|
18
|
+
const offerable = (plugin, ctx) => {
|
|
19
|
+
if (plugin.method == null || plugin.method.hidden === true) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
if (plugin.requiresRenderer === true && plugin.Renderer == null) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
return plugin.method.available?.(ctx) !== false;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Every registered authentication plugin that declares itself offerable, as a sign-in method.
|
|
29
|
+
*/
|
|
30
|
+
export const pluginMethodSource = {
|
|
31
|
+
alias: 'authentication-plugins',
|
|
32
|
+
list: ctx => listAuthPlugins()
|
|
33
|
+
.filter(plugin => offerable(plugin, ctx))
|
|
34
|
+
.map((plugin) => {
|
|
35
|
+
const meta = plugin.method;
|
|
36
|
+
const type = plugin.type;
|
|
37
|
+
const id = meta.id ?? type;
|
|
38
|
+
return {
|
|
39
|
+
id, type,
|
|
40
|
+
...(meta.label != null ? { label: meta.label } : {}),
|
|
41
|
+
i18nKey: meta.i18nKey ?? id,
|
|
42
|
+
...(meta.icon != null ? { icon: meta.icon } : {}),
|
|
43
|
+
order: meta.order ?? DEFAULT_METHOD_ORDER,
|
|
44
|
+
...(meta.emphasis != null ? { emphasis: meta.emphasis } : {}),
|
|
45
|
+
...(meta.restricted === true ? { restricted: true } : {}),
|
|
46
|
+
params: { type },
|
|
47
|
+
// Non-async through the whole chain: `login.begin` opens the surrogate window in its first
|
|
48
|
+
// statement, and a window opened after the gesture has been handled is blocked.
|
|
49
|
+
start: methodCtx => {
|
|
50
|
+
const login = methodCtx.context.service(LOGIN_SERVICE);
|
|
51
|
+
const entrypoint = methodCtx.context.entrypoint(CAUTHEN_AUTHEN_TYPED);
|
|
52
|
+
const url = entrypoint.path().replace(':type', encodeURIComponent(type));
|
|
53
|
+
return login.begin({
|
|
54
|
+
url,
|
|
55
|
+
// In an ordinary tab this keeps the application mounted, exactly as the pre-chooser
|
|
56
|
+
// dispatcher did; the surrogate plugin ignores it and opens a window instead.
|
|
57
|
+
...(methodCtx.navigate != null
|
|
58
|
+
? { navigate: () => methodCtx.navigate?.(CAUTHEN_AUTHEN_TYPED, { type }) }
|
|
59
|
+
: {}),
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}),
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=methods.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods.js","sourceRoot":"","sources":["../../../src/manager/plugins/methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAErD,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAG3E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAE/C;;;;;;;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;AAGtD,eAAO,MAAM,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"re-captcha.d.ts","sourceRoot":"","sources":["../../../src/manager/plugins/re-captcha.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAGtD,eAAO,MAAM,eAAe,EAAE,oBAiC7B,CAAA"}
|
|
@@ -3,6 +3,11 @@ import { AuthenticationStage, AuthenticationType } from '@owlmeans/auth';
|
|
|
3
3
|
import { useEffect } from 'react';
|
|
4
4
|
export const reCaptchaPlugin = {
|
|
5
5
|
type: AuthenticationType.ReCaptcha,
|
|
6
|
+
// A STEP inside another flow, never a way to sign in — so it is registered and never offered.
|
|
7
|
+
method: { hidden: true },
|
|
8
|
+
// Its widget is a `Renderer` a panel package assigns. `hidden` already keeps it off the sign-in
|
|
9
|
+
// screen; this is what the flow that DOES drive it can check before handing it a stage.
|
|
10
|
+
requiresRenderer: true,
|
|
6
11
|
Implementation: Renderer => ({ type, stage, control, params }) => {
|
|
7
12
|
Renderer = Renderer ?? reCaptchaPlugin.Renderer;
|
|
8
13
|
// ReCaptcha authentication requests allowance unconditionally
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"re-captcha.js","sourceRoot":"","sources":["../../../src/manager/plugins/re-captcha.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAExE,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,MAAM,CAAC,MAAM,eAAe,GAAyB;IACnD,IAAI,EAAE,kBAAkB,CAAC,SAAS;IAElC,cAAc,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE;QAC/D,QAAQ,GAAG,QAAQ,IAAI,eAAe,CAAC,QAAQ,CAAA;QAE/C,+DAA+D;QAC/D,+CAA+C;QA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;QAC/C,SAAS,CAAC,GAAG,EAAE;YACb,IAAI,OAAO,CAAC,KAAK,KAAK,mBAAmB,CAAC,IAAI,EAAE,CAAC;gBAC/C,KAAK,OAAO,CAAC,gBAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;YACjE,CAAC;QACH,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;QAEV,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;YACrB,MAAM,IAAI,WAAW,CAAC,8CAA8C,CAAC,CAAA;QACvE,CAAC;QAED,OAAO,KAAC,QAAQ,IAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAI,CAAA;IACjF,CAAC;IAED;;;OAGG;IACH,YAAY,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;CAC1C,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ClientAuthType } from '../components/authentication/types.js';
|
|
2
|
+
import type { AuthenticationPlugin } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* The registry every authentication plugin lands in.
|
|
5
|
+
*
|
|
6
|
+
* It stays a plain exported object, and every registration stays a plain assignment, because four
|
|
7
|
+
* packages already write into it from side-effect imports (`web-oidc-rp`, `mui-oidc-rp`,
|
|
8
|
+
* `web-auth`, and this package's own `index`). Hiding it behind an API would break all of them for
|
|
9
|
+
* no gain — the functions below simply read it.
|
|
10
|
+
*
|
|
11
|
+
* It lives in its own module rather than in `index.ts` so that the method source can read it
|
|
12
|
+
* without the two importing each other.
|
|
13
|
+
*/
|
|
14
|
+
export declare const plugins: {
|
|
15
|
+
[type: ClientAuthType]: AuthenticationPlugin;
|
|
16
|
+
};
|
|
17
|
+
export declare const registerAuthPlugin: (plugin: AuthenticationPlugin) => AuthenticationPlugin;
|
|
18
|
+
export declare const getAuthPlugin: (type: ClientAuthType) => AuthenticationPlugin | undefined;
|
|
19
|
+
export declare const listAuthPlugins: () => AuthenticationPlugin[];
|
|
20
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/manager/plugins/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA;AAC3E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAEtD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,OAAO,EAAE;IAAE,CAAC,IAAI,EAAE,cAAc,GAAG,oBAAoB,CAAA;CAAO,CAAA;AAE3E,eAAO,MAAM,kBAAkB,WAAY,oBAAoB,KAAG,oBAIjE,CAAA;AAED,eAAO,MAAM,aAAa,SAAU,cAAc,KAAG,oBAAoB,GAAG,SAC7D,CAAA;AAEf,eAAO,MAAM,eAAe,QAAO,oBAAoB,EAA4B,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The registry every authentication plugin lands in.
|
|
3
|
+
*
|
|
4
|
+
* It stays a plain exported object, and every registration stays a plain assignment, because four
|
|
5
|
+
* packages already write into it from side-effect imports (`web-oidc-rp`, `mui-oidc-rp`,
|
|
6
|
+
* `web-auth`, and this package's own `index`). Hiding it behind an API would break all of them for
|
|
7
|
+
* no gain — the functions below simply read it.
|
|
8
|
+
*
|
|
9
|
+
* It lives in its own module rather than in `index.ts` so that the method source can read it
|
|
10
|
+
* without the two importing each other.
|
|
11
|
+
*/
|
|
12
|
+
export const plugins = {};
|
|
13
|
+
export const registerAuthPlugin = (plugin) => {
|
|
14
|
+
plugins[plugin.type] = plugin;
|
|
15
|
+
return plugin;
|
|
16
|
+
};
|
|
17
|
+
export const getAuthPlugin = (type) => plugins[type];
|
|
18
|
+
export const listAuthPlugins = () => Object.values(plugins);
|
|
19
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/manager/plugins/registry.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,OAAO,GAAqD,EAAE,CAAA;AAE3E,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAA4B,EAAwB,EAAE;IACvF,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAA;IAE7B,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAoB,EAAoC,EAAE,CACtF,OAAO,CAAC,IAAI,CAAC,CAAA;AAEf,MAAM,CAAC,MAAM,eAAe,GAAG,GAA2B,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tunnel-consumer.d.ts","sourceRoot":"","sources":["../../../src/manager/plugins/tunnel-consumer.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAStD,eAAO,MAAM,sBAAsB,EAAE,
|
|
1
|
+
{"version":3,"file":"tunnel-consumer.d.ts","sourceRoot":"","sources":["../../../src/manager/plugins/tunnel-consumer.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAStD,eAAO,MAAM,sBAAsB,EAAE,oBAoEpC,CAAA"}
|
|
@@ -7,6 +7,10 @@ import { RELY_ACTION_TIMEOUT, RELY_PIN_PERFIX } from '@owlmeans/auth-common';
|
|
|
7
7
|
import { createWalletFacade } from './tunnel/wallet.js';
|
|
8
8
|
export const tunnelConsumerUIPlugin = {
|
|
9
9
|
type: AuthenticationType.WalletConsumer,
|
|
10
|
+
method: { order: 400, icon: 'wallet' },
|
|
11
|
+
// The PIN form is a `Renderer` a panel package assigns; without one the Implementation throws on
|
|
12
|
+
// mount, so the method must not be offered.
|
|
13
|
+
requiresRenderer: true,
|
|
10
14
|
Implementation: renderer => ({ type, stage, control, params }) => {
|
|
11
15
|
type = type ?? AuthenticationType.WalletConsumer;
|
|
12
16
|
const Renderer = renderer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tunnel-consumer.js","sourceRoot":"","sources":["../../../src/manager/plugins/tunnel-consumer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAI3G,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAE9C,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAEhE,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAEvD,MAAM,CAAC,MAAM,sBAAsB,GAAyB;IAC1D,IAAI,EAAE,kBAAkB,CAAC,cAAc;IAEvC,cAAc,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE;QAC/D,IAAI,GAAG,IAAI,IAAI,kBAAkB,CAAC,cAAc,CAAA;QAChD,MAAM,QAAQ,GAA6C,QAAQ;eAC9D,sBAAsB,CAAC,QAAQ,CAAA;QAEpC,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,CAAC,CAAA;QAErC,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;YACrB,MAAM,IAAI,WAAW,CAAC,mDAAmD,CAAC,CAAA;QAC5E,CAAC;QAED,SAAS,CAAC,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AC,IAAgB,EAAE,OAA8B,EAAE,EAAE,CAAC,KAAK,EAAE,IAAa,EAAE,EAAE;IAC/F,MAAM,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAA;IAC7D,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAwB,mBAAmB,CAAC,YAAY,EAAE;YACpF,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,SAAS,IAAI,EAAE;YAC7C,UAAU,EAAE,eAAe,GAAG,IAAI,CAAC,GAAG;YACtC,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,IAAI,EAAE,QAAQ,CAAC,KAAK;YACpB,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,CAAC,UAAU,CAAC;SACrB,CAAC,CAAA;QAEF,IAAI,IAAI,CAAC,KAAK,KAAK,mBAAmB,CAAC,aAAa,EAAE,CAAC;YACrD,IAAI,OAAO,CAAC,QAAQ,IAAI,IAAI,EAAE,CAAC;gBAC7B,MAAM,IAAI,WAAW,CAAC,kEAAkE,CAAC,CAAA;YAC3F,CAAC;YACD,MAAM,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAA;QACxD,CAAC;QACD,SAAS;IACX,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,IAAI,CAAC,KAAK,EAAE,CAAA;QAClB,MAAM,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;IAC3B,CAAC;AACH,CAAC,CAAA"}
|
|
@@ -1,9 +1,62 @@
|
|
|
1
1
|
import type { FC } from 'react';
|
|
2
|
+
import type { LoginMethodEmphasis } from '@owlmeans/config';
|
|
3
|
+
import type { LoginMethodContext } from '../../login/types.js';
|
|
2
4
|
import type { AuthenticationControl, AuthenticationRenderer, AuthenticationRendererProps } from '../components/authentication/types.js';
|
|
3
5
|
export interface AuthenticationPlugin extends Pick<AuthenticationControl, "beforeAuthenticate" | "afterAuthenticate">, Pick<Partial<AuthenticationControl>, "authenticate"> {
|
|
4
6
|
type: string;
|
|
5
7
|
Implementation: PluginImplemnetation;
|
|
6
8
|
Renderer?: AuthenticationRenderer;
|
|
9
|
+
/**
|
|
10
|
+
* This plugin's `Implementation` cannot render without a `Renderer` a UI package supplies.
|
|
11
|
+
*
|
|
12
|
+
* It is declared rather than inferred because there is nothing to infer it from: a plugin that
|
|
13
|
+
* renders its own form and one that throws `Renderer is not defined` are the same object until
|
|
14
|
+
* the screen mounts. Declaring it is what lets the sign-in screen leave out a method whose
|
|
15
|
+
* renderer nobody registered, instead of offering a button that crashes the page it opens.
|
|
16
|
+
*/
|
|
17
|
+
requiresRenderer?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* How this method presents itself on the sign-in screen.
|
|
20
|
+
*
|
|
21
|
+
* Absent means the plugin is never OFFERED — it is still reachable by type, which is what a
|
|
22
|
+
* step-in-a-flow (re-captcha) and a plugin an app deep-links to both need. Every field is
|
|
23
|
+
* optional so an existing plugin object keeps type-checking without being touched.
|
|
24
|
+
*/
|
|
25
|
+
method?: AuthMethodMeta;
|
|
26
|
+
}
|
|
27
|
+
export interface AuthMethodMeta {
|
|
28
|
+
/** Defaults to the plugin's `type`. */
|
|
29
|
+
id?: string;
|
|
30
|
+
/** Literal fallback used when no translation resolves. */
|
|
31
|
+
label?: string;
|
|
32
|
+
/** Key under the `auth` library's `login.method.*`; defaults to the id. */
|
|
33
|
+
i18nKey?: string;
|
|
34
|
+
/** Icon registry NAME, never markup — this package must stay free of an icon library. */
|
|
35
|
+
icon?: string;
|
|
36
|
+
/** Ascending; default 100. */
|
|
37
|
+
order?: number;
|
|
38
|
+
emphasis?: LoginMethodEmphasis;
|
|
39
|
+
/**
|
|
40
|
+
* Never offered unless the configuration explicitly enables it.
|
|
41
|
+
*
|
|
42
|
+
* This is the secret-key gate: an operator login is registered like any other method and must
|
|
43
|
+
* not become offerable merely by being registered.
|
|
44
|
+
*/
|
|
45
|
+
restricted?: boolean;
|
|
46
|
+
/** Registered, but never a choice. */
|
|
47
|
+
hidden?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Whether the application this method is about to be offered in actually wired it.
|
|
50
|
+
*
|
|
51
|
+
* The plugin registry is global and is written to by side-effect imports, so being registered
|
|
52
|
+
* says only that some bundle pulled the module in — and modules arrive in groups. An app that
|
|
53
|
+
* wanted one method out of a package gets every method that package registers, including ones
|
|
54
|
+
* whose first act is to look up a service its context never appended. This is where a plugin
|
|
55
|
+
* says so, per context, at render time; `false` leaves it off the screen.
|
|
56
|
+
*
|
|
57
|
+
* Absent means "always", which is right for a plugin that needs nothing but itself.
|
|
58
|
+
*/
|
|
59
|
+
available?: (ctx: LoginMethodContext) => boolean;
|
|
7
60
|
}
|
|
8
61
|
export interface PluginImplemnetation {
|
|
9
62
|
(Renderer?: AuthenticationRenderer): FC<AuthenticationRendererProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/manager/plugins/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,KAAK,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,2BAA2B,EAAG,MAAM,uCAAuC,CAAA;AAExI,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAChD,qBAAqB,EAAE,oBAAoB,GAAG,mBAAmB,CAClE,EAAE,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,EAAE,cAAc,CAAC;IACrD,IAAI,EAAE,MAAM,CAAA;IACZ,cAAc,EAAE,oBAAoB,CAAA;IACpC,QAAQ,CAAC,EAAE,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/manager/plugins/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,KAAK,EAAE,m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(alias = DEFAULT_ALIAS) => {
|
|
|
12
12
|
},
|
|
13
13
|
authenticate: async (token) => {
|
|
14
14
|
const context = assertContext(service.ctx, location);
|
|
15
|
-
const
|
|
15
|
+
const authToken = await context.entrypoint(DISPATCHER_AUTHEN)
|
|
16
16
|
.call({ body: token });
|
|
17
17
|
await service.update(authToken.token);
|
|
18
18
|
},
|
package/build/service.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEhE,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAGtE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAEtD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAK,GAAW,aAAa,EAAe,EAAE;IAC5E,MAAM,QAAQ,GAAG,gBAAgB,KAAK,EAAE,CAAA;IACxC,MAAM,OAAO,GAAgB,aAAa,CAAc,KAAK,EAAE;QAC7D,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,IAAI,IAAI;QAElD,MAAM,EAAE,KAAK,IAAO,EAAE;YACpB,OAAO,KAAK,CAAM,CAAA;QACpB,CAAC;QAED,YAAY,EAAE,KAAK,EAAC,KAAK,EAAC,EAAE;YAC1B,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;YAEpD,MAAM,
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,a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E,CAAA;gBACnC,CAAC;YACH,CAAC;YAED,OAAO,OAAO,CAAC,KAAK,IAAI,IAAI,CAAA;QAC9B,CAAC;QAED,IAAI,EAAE,GAAG,EAAE;YACT,IAAI,OAAO,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC;gBACzB,MAAM,IAAI,kBAAkB,EAAE,CAAA;YAChC,CAAC;YAED,OAAO,OAAO,CAAC,IAAI,CAAA;QACrB,CAAC;QAED,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC;KACjE,CAAC,CAAA;IAEF,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,GAAM,EAAE,KAAK,GAAW,aAAa,EACd,EAAE;IACzB,MAAM,OAAO,GAAG,eAAe,CAAC,KAAK,CAAC,CAAA;IAEtC,MAAM,OAAO,GAAG,GAA4B,CAAA;IAE5C,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAA;IAEhC,OAAO,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAA;IAE1C,OAAO,CAAC,IAAI,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAE/C,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlmeans/client-auth",
|
|
3
|
-
"version": "0.1.18-rc.
|
|
3
|
+
"version": "0.1.18-rc.21",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
"module": "./build/manager/index.js",
|
|
28
28
|
"types": "./build/manager/index.d.ts"
|
|
29
29
|
},
|
|
30
|
-
"./manager/
|
|
31
|
-
"import": "./build/manager/
|
|
32
|
-
"require": "./build/manager/
|
|
33
|
-
"default": "./build/manager/
|
|
34
|
-
"module": "./build/manager/
|
|
35
|
-
"types": "./build/manager/
|
|
30
|
+
"./manager/entrypoints": {
|
|
31
|
+
"import": "./build/manager/entrypoints.js",
|
|
32
|
+
"require": "./build/manager/entrypoints.js",
|
|
33
|
+
"default": "./build/manager/entrypoints.js",
|
|
34
|
+
"module": "./build/manager/entrypoints.js",
|
|
35
|
+
"types": "./build/manager/entrypoints.d.ts"
|
|
36
36
|
},
|
|
37
37
|
"./manager/plugins": {
|
|
38
38
|
"import": "./build/manager/plugins/exports.js",
|
|
@@ -40,27 +40,36 @@
|
|
|
40
40
|
"default": "./build/manager/plugins/exports.js",
|
|
41
41
|
"module": "./build/manager/plugins/exports.js",
|
|
42
42
|
"types": "./build/manager/plugins/exports.d.ts"
|
|
43
|
+
},
|
|
44
|
+
"./login": {
|
|
45
|
+
"import": "./build/login/index.js",
|
|
46
|
+
"require": "./build/login/index.js",
|
|
47
|
+
"default": "./build/login/index.js",
|
|
48
|
+
"module": "./build/login/index.js",
|
|
49
|
+
"types": "./build/login/index.d.ts"
|
|
43
50
|
}
|
|
44
51
|
},
|
|
45
52
|
"dependencies": {
|
|
46
|
-
"@owlmeans/auth": "^0.1.18-rc.
|
|
47
|
-
"@owlmeans/auth-common": "^0.1.18-rc.
|
|
48
|
-
"@owlmeans/basic-envelope": "^0.1.18-rc.
|
|
49
|
-
"@owlmeans/basic-keys": "^0.1.18-rc.
|
|
50
|
-
"@owlmeans/client": "^0.1.18-rc.
|
|
51
|
-
"@owlmeans/client-context": "^0.1.18-rc.
|
|
52
|
-
"@owlmeans/client-
|
|
53
|
-
"@owlmeans/client-
|
|
54
|
-
"@owlmeans/client-resource": "^0.1.18-rc.
|
|
55
|
-
"@owlmeans/client-socket": "^0.1.18-rc.
|
|
56
|
-
"@owlmeans/
|
|
57
|
-
"@owlmeans/
|
|
58
|
-
"@owlmeans/
|
|
59
|
-
"@owlmeans/
|
|
60
|
-
"@owlmeans/
|
|
61
|
-
"@owlmeans/
|
|
62
|
-
"@owlmeans/
|
|
63
|
-
"@owlmeans/
|
|
53
|
+
"@owlmeans/auth": "^0.1.18-rc.10",
|
|
54
|
+
"@owlmeans/auth-common": "^0.1.18-rc.14",
|
|
55
|
+
"@owlmeans/basic-envelope": "^0.1.18-rc.13",
|
|
56
|
+
"@owlmeans/basic-keys": "^0.1.18-rc.13",
|
|
57
|
+
"@owlmeans/client": "^0.1.18-rc.17",
|
|
58
|
+
"@owlmeans/client-context": "^0.1.18-rc.14",
|
|
59
|
+
"@owlmeans/client-entrypoint": "^0.1.18-rc.14",
|
|
60
|
+
"@owlmeans/client-flow": "^0.1.18-rc.18",
|
|
61
|
+
"@owlmeans/client-resource": "^0.1.18-rc.14",
|
|
62
|
+
"@owlmeans/client-socket": "^0.1.18-rc.15",
|
|
63
|
+
"@owlmeans/config": "^0.1.18-rc.13",
|
|
64
|
+
"@owlmeans/context": "^0.1.18-rc.9",
|
|
65
|
+
"@owlmeans/did": "^0.1.18-rc.13",
|
|
66
|
+
"@owlmeans/entrypoint": "^0.1.18-rc.12",
|
|
67
|
+
"@owlmeans/error": "^0.1.18-rc.9",
|
|
68
|
+
"@owlmeans/flow": "^0.1.18-rc.15",
|
|
69
|
+
"@owlmeans/i18n": "^0.1.18-rc.9",
|
|
70
|
+
"@owlmeans/resource": "^0.1.18-rc.10",
|
|
71
|
+
"@owlmeans/socket": "^0.1.18-rc.10",
|
|
72
|
+
"@owlmeans/web-flow": "^0.1.18-rc.18",
|
|
64
73
|
"@scure/base": "^2.3.0"
|
|
65
74
|
},
|
|
66
75
|
"peerDependencies": {
|
|
@@ -69,8 +78,8 @@
|
|
|
69
78
|
},
|
|
70
79
|
"devDependencies": {
|
|
71
80
|
"@owlmeans/dep-config": "workspace:*",
|
|
72
|
-
"@owlmeans/test-auth": "^0.1.18-rc.
|
|
73
|
-
"@types/bun": "^1.
|
|
81
|
+
"@owlmeans/test-auth": "^0.1.18-rc.14",
|
|
82
|
+
"@types/bun": "^1.4.0",
|
|
74
83
|
"@types/react": "^19.2.17",
|
|
75
84
|
"nodemon": "^3.1.14",
|
|
76
85
|
"typescript": "^7.0.2"
|
|
@@ -19,7 +19,7 @@ export const DispatcherHOC: TDispatcherHOC = Renderer => ({ context, params, ali
|
|
|
19
19
|
const navigator = useNavigate()
|
|
20
20
|
const navigate = useCallback(async () => {
|
|
21
21
|
alias = alias == null || alias === DISPATCHER ? HOME : alias
|
|
22
|
-
const module = context.
|
|
22
|
+
const module = context.entrypoint<ClientEntrypoint<string>>(alias)
|
|
23
23
|
if (alias === HOME) {
|
|
24
24
|
params = {}
|
|
25
25
|
query = {}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
import { elevate, stab } from '@owlmeans/client-entrypoint'
|
|
3
|
-
import {
|
|
3
|
+
import { entrypoints as list } from '@owlmeans/auth-common'
|
|
4
4
|
import { CAUTHEN_FLOW_ENTER, DISPATCHER_AUTHEN } from '@owlmeans/auth'
|
|
5
5
|
import type { ClientEntrypoint } from '@owlmeans/client-entrypoint'
|
|
6
6
|
|
|
7
7
|
elevate(list, DISPATCHER_AUTHEN)
|
|
8
8
|
|
|
9
|
-
export const
|
|
9
|
+
export const entrypoints: ClientEntrypoint[] = list as ClientEntrypoint[]
|
|
10
10
|
|
|
11
11
|
export const setupExternalAuthentication = (service: string) => {
|
|
12
12
|
elevate(list, CAUTHEN_FLOW_ENTER, stab, { routeOptions: { overrides: { service } } })
|
package/src/helper.ts
CHANGED
|
@@ -22,7 +22,7 @@ export const useWs = (
|
|
|
22
22
|
|
|
23
23
|
const request = useMemo(() => {
|
|
24
24
|
if (_request == null) {
|
|
25
|
-
_request = provideRequest(mod.
|
|
25
|
+
_request = provideRequest(mod.alias, mod.path())
|
|
26
26
|
}
|
|
27
27
|
try {
|
|
28
28
|
if (_request?.query?.[AUTH_QUERY] == null) {
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { AuthService } from '@owlmeans/auth-common'
|
|
2
|
+
import { DEFAULT_ALIAS as AUTH_ALIAS } from '../consts.js'
|
|
3
|
+
import type { LoginContext } from './types.js'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The one path an issued bearer token becomes this context's authentication.
|
|
7
|
+
*
|
|
8
|
+
* Resolved by alias rather than through `ctx.auth()` so the login host does not require
|
|
9
|
+
* `AuthServiceAppend` on the context it is given — a plugin can adopt a token on any context that
|
|
10
|
+
* carries the auth service, including one it did not build.
|
|
11
|
+
*
|
|
12
|
+
* Going through `AuthService.update` matters: it stores the record, decodes the envelope and sets
|
|
13
|
+
* both `auth` and `token` in one place. Writing those three by hand — which is what the popup and
|
|
14
|
+
* the MUI relying party each used to do — leaves the same state on a good day and diverges the
|
|
15
|
+
* moment any of it changes.
|
|
16
|
+
*/
|
|
17
|
+
export const adoptToken = async (ctx: LoginContext, token: string): Promise<void> => {
|
|
18
|
+
await ctx.service<AuthService>(AUTH_ALIAS).update(token)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The one path this context's authentication is dropped, and the exact mirror of {@link adoptToken}.
|
|
23
|
+
*
|
|
24
|
+
* `undefined`, not `null`: `undefined` is the declared clearing value, and on the web the auth
|
|
25
|
+
* service reacts to it by navigating to the dispatcher. Everything that signs a user out goes
|
|
26
|
+
* through here — the hook, both browser plugins and the surrogate screen — so there is one place
|
|
27
|
+
* where "signed out" is defined rather than four that agree until one of them changes.
|
|
28
|
+
*/
|
|
29
|
+
export const revokeToken = async (ctx: LoginContext): Promise<void> => {
|
|
30
|
+
await ctx.service<AuthService>(AUTH_ALIAS).update(undefined)
|
|
31
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export const DEFAULT_ALIAS = 'login-service'
|
|
2
|
+
|
|
3
|
+
export const LOGIN_SERVICE = DEFAULT_ALIAS
|
|
4
|
+
|
|
5
|
+
/** Priority of a plugin that makes no claim about the environment. */
|
|
6
|
+
export const DEFAULT_LOGIN_PRIORITY = 0
|
|
7
|
+
|
|
8
|
+
/** Order given to a method that declares none. */
|
|
9
|
+
export const DEFAULT_METHOD_ORDER = 100
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Name given to the surrogate login window, the marker it records about itself, and the values the
|
|
13
|
+
* two documents exchange.
|
|
14
|
+
*
|
|
15
|
+
* These are a wire protocol between two documents that may be running different builds — an opener
|
|
16
|
+
* holding an older bundle and a surrogate freshly loaded, or the reverse. They are therefore fixed,
|
|
17
|
+
* and must never be "tidied" to match a newer vocabulary. That applies to the query names and the
|
|
18
|
+
* message types added later just as much as to the original three.
|
|
19
|
+
*/
|
|
20
|
+
export const LOGIN_SURROGATE_NAME = 'owlmeans-oidc-login'
|
|
21
|
+
|
|
22
|
+
export const LOGIN_TOKEN_MESSAGE = 'owlmeans:oidc:popup-token'
|
|
23
|
+
|
|
24
|
+
export const LOGIN_LOGOUT_MESSAGE = 'owlmeans:oidc:popup-logout'
|
|
25
|
+
|
|
26
|
+
export const LOGIN_SURROGATE_MARKER = '_owlmeans-oidc-popup'
|
|
27
|
+
|
|
28
|
+
export const LOGIN_SURROGATE_FEATURES = 'popup=yes,width=520,height=760'
|
|
29
|
+
|
|
30
|
+
/** How often a surrogate window is checked for having been closed by the user. */
|
|
31
|
+
export const LOGIN_WATCH_INTERVAL = 500
|
|
32
|
+
|
|
33
|
+
/** Carries WHY the surrogate window was opened across the window boundary. */
|
|
34
|
+
export const LOGIN_INTENT_QUERY = 'intent'
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Carries the address the surrogate should run, so the flow parameters the opener's URL held are
|
|
38
|
+
* forwarded rather than discarded.
|
|
39
|
+
*/
|
|
40
|
+
export const LOGIN_NEXT_QUERY = 'next'
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Carries the method the user already chose, one window up.
|
|
44
|
+
*
|
|
45
|
+
* A surrogate acting on it is not an auto-redirect in the "never choose for the user" sense: the
|
|
46
|
+
* choice was made, by a person, in the document that opened this one.
|
|
47
|
+
*/
|
|
48
|
+
export const LOGIN_METHOD_QUERY = 'method'
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Says that this window was opened to PRODUCE a session, not to find one.
|
|
52
|
+
*
|
|
53
|
+
* A surrogate window runs on the application's own origin, so it can see a session the application
|
|
54
|
+
* left there earlier — and a session that is merely present is not a session that still works. The
|
|
55
|
+
* document holding it has no way to tell: `authenticated()` reads storage and decodes an envelope,
|
|
56
|
+
* and nothing in the client asks the server whether the record behind it is still there. So a
|
|
57
|
+
* revoked, replaced or expired token was handed straight back to the window that asked for a
|
|
58
|
+
* login, which adopted it, failed every call it made with it, and asked again — the same dead
|
|
59
|
+
* token, every time, for as long as the browser kept it. Clearing site data was the only exit,
|
|
60
|
+
* which is exactly how the defect was reported.
|
|
61
|
+
*
|
|
62
|
+
* With this set, the surrogate and the dispatcher both skip the resume and run the authorization
|
|
63
|
+
* flow. That is not the expensive path it sounds like: the provider's own session normally answers
|
|
64
|
+
* the request without asking the person anything, and what comes back is a token the provider has
|
|
65
|
+
* just vouched for. It is also what makes signing in as somebody else possible at all.
|
|
66
|
+
*/
|
|
67
|
+
export const LOGIN_FRESH_QUERY = 'fresh'
|
|
68
|
+
|
|
69
|
+
/** Where a browser records that it agreed to one exact set of legal documents. */
|
|
70
|
+
export const LOGIN_TERMS_STORAGE = '_owlmeans-login-terms'
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { BrandSettings, LoginCreditConfig } from '@owlmeans/config'
|
|
2
|
+
|
|
3
|
+
export interface ResolvedCredit {
|
|
4
|
+
/** Whether "Powered by OwlMeans" is rendered. */
|
|
5
|
+
poweredBy: boolean
|
|
6
|
+
/** The product and organization line, already composed. Null when there is nothing to say. */
|
|
7
|
+
line: string | null
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The years one notice covers.
|
|
12
|
+
*
|
|
13
|
+
* A range only while the first year is genuinely in the past — an app configured with the current
|
|
14
|
+
* year, or with a year a skewed clock puts in the future, still gets a well-formed notice rather
|
|
15
|
+
* than `© 2026–2026` or a range that runs backwards.
|
|
16
|
+
*/
|
|
17
|
+
const years = (since: number | undefined, now: number): string =>
|
|
18
|
+
since != null && since > 0 && since < now ? `${since}–${now}` : `${now}`
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* A configured value that was actually SET.
|
|
22
|
+
*
|
|
23
|
+
* Empty is how a build-time default spells "unset", and this config is filled from environment
|
|
24
|
+
* variables a platform delivers — `BRANDING_ORGANIZATION: meta.brandingOrganization ?? ''` is the
|
|
25
|
+
* shape of every one of them. `??` does not fall through an empty string, so an undelivered
|
|
26
|
+
* organization used to win the fallback chain and compose a line ending in a bare dash.
|
|
27
|
+
*/
|
|
28
|
+
const set = (value?: string | null): string | null =>
|
|
29
|
+
value != null && value.trim() !== '' ? value : null
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* What the bottom of the sign-in screen says.
|
|
33
|
+
*
|
|
34
|
+
* It is a copyright notice, so it is composed as one: `© <year> <holder>`. That is the whole
|
|
35
|
+
* reason `copyright` defaults to on — the name on its own reads as a caption, and an application
|
|
36
|
+
* that means to assert a copyright would have had to write the mark and the year into a literal
|
|
37
|
+
* `line` to get one.
|
|
38
|
+
*
|
|
39
|
+
* The organization falls back to its slug because an organization record carries no readable name
|
|
40
|
+
* — so "no name" is the ordinary case, not an error, and a screen that rendered an empty line for
|
|
41
|
+
* it would be worse than one that renders the slug.
|
|
42
|
+
*
|
|
43
|
+
* `line` replaces everything when an app supplies it: a product with its own legal wording should
|
|
44
|
+
* not have to defeat a composition rule to use it.
|
|
45
|
+
*/
|
|
46
|
+
export const resolveCredit = (
|
|
47
|
+
cfg?: LoginCreditConfig, brand?: BrandSettings, service?: string
|
|
48
|
+
): ResolvedCredit => {
|
|
49
|
+
const poweredBy = cfg?.poweredBy ?? true
|
|
50
|
+
const literal = set(cfg?.line)
|
|
51
|
+
if (literal != null) {
|
|
52
|
+
return { poweredBy, line: literal }
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const product = set(cfg?.product) ?? set(brand?.name) ?? set(service)
|
|
56
|
+
const organization = set(cfg?.organization) ?? set(brand?.organization)
|
|
57
|
+
?? set(cfg?.entity) ?? set(brand?.entity)
|
|
58
|
+
|
|
59
|
+
// Whoever the notice names. A product with no organization behind it holds its own copyright,
|
|
60
|
+
// which is why this falls through to the product rather than dropping the notice.
|
|
61
|
+
const holder = set(cfg?.holder) ?? organization ?? product
|
|
62
|
+
const wording = typeof cfg?.copyright === 'string' ? set(cfg.copyright) : null
|
|
63
|
+
const notice = cfg?.copyright === false || holder == null
|
|
64
|
+
? organization
|
|
65
|
+
: wording ?? `© ${years(cfg?.since, new Date().getFullYear())} ${holder}`
|
|
66
|
+
|
|
67
|
+
// The product is named beside the notice only when it is not already the thing being claimed —
|
|
68
|
+
// "OwlMeans — © 2026 OwlMeans" says the name twice and neither time usefully.
|
|
69
|
+
return {
|
|
70
|
+
poweredBy,
|
|
71
|
+
line: product != null && notice != null && product !== holder
|
|
72
|
+
? `${product} — ${notice}`
|
|
73
|
+
: notice ?? product,
|
|
74
|
+
}
|
|
75
|
+
}
|