@owlmeans/client-auth 0.1.18-rc.6 → 0.1.18-rc.60
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 +283 -37
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/client-auth/SKILL.md +170 -21
- package/build/components/dispatcher/component.d.ts.map +1 -1
- package/build/components/dispatcher/component.js +26 -6
- package/build/components/dispatcher/component.js.map +1 -1
- package/build/components/dispatcher/types.local.d.ts +7 -0
- package/build/components/dispatcher/types.local.d.ts.map +1 -0
- package/build/components/dispatcher/types.local.js +2 -0
- package/build/components/dispatcher/types.local.js.map +1 -0
- package/build/entrypoints.d.ts +7 -0
- package/build/entrypoints.d.ts.map +1 -0
- package/build/entrypoints.js +7 -0
- package/build/entrypoints.js.map +1 -0
- package/build/helper.d.ts +2 -1
- package/build/helper.d.ts.map +1 -1
- package/build/helper.js +28 -5
- 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/types.d.ts +26 -0
- package/build/login/adopt/types.d.ts.map +1 -0
- package/build/login/adopt/types.js +2 -0
- package/build/login/adopt/types.js.map +1 -0
- package/build/login/adopt.d.ts +10 -0
- package/build/login/adopt.d.ts.map +1 -0
- package/build/login/adopt.js +18 -0
- package/build/login/adopt.js.map +1 -0
- package/build/login/consts.d.ts +103 -0
- package/build/login/consts.d.ts.map +1 -0
- package/build/login/consts.js +106 -0
- package/build/login/consts.js.map +1 -0
- package/build/login/consts.local.d.ts +16 -0
- package/build/login/consts.local.d.ts.map +1 -0
- package/build/login/consts.local.js +30 -0
- package/build/login/consts.local.js.map +1 -0
- package/build/login/credit/types.d.ts +7 -0
- package/build/login/credit/types.d.ts.map +1 -0
- package/build/login/credit/types.js +2 -0
- package/build/login/credit/types.js.map +1 -0
- package/build/login/credit.d.ts +19 -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/types.d.ts +35 -0
- package/build/login/env/types.d.ts.map +1 -0
- package/build/login/env/types.js +2 -0
- package/build/login/env/types.js.map +1 -0
- package/build/login/env.d.ts +8 -0
- package/build/login/env.d.ts.map +1 -0
- package/build/login/env.js +67 -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 +52 -0
- package/build/login/hook.d.ts.map +1 -0
- package/build/login/hook.js +89 -0
- package/build/login/hook.js.map +1 -0
- package/build/login/i18n/be.json +41 -0
- package/build/login/i18n/de.json +41 -0
- package/build/login/i18n/en.json +41 -0
- package/build/login/i18n/es.json +41 -0
- package/build/login/i18n/fr.json +41 -0
- package/build/login/i18n/pl.json +41 -0
- package/build/login/i18n/ru.json +41 -0
- package/build/login/i18n/uk.json +41 -0
- package/build/login/i18n.d.ts +2 -0
- package/build/login/i18n.d.ts.map +1 -0
- package/build/login/i18n.js +27 -0
- package/build/login/i18n.js.map +1 -0
- package/build/login/index.d.ts +27 -0
- package/build/login/index.d.ts.map +1 -0
- package/build/login/index.js +18 -0
- package/build/login/index.js.map +1 -0
- package/build/login/land/types.d.ts +52 -0
- package/build/login/land/types.d.ts.map +1 -0
- package/build/login/land/types.js +2 -0
- package/build/login/land/types.js.map +1 -0
- package/build/login/land.d.ts +6 -0
- package/build/login/land.d.ts.map +1 -0
- package/build/login/land.js +122 -0
- package/build/login/land.js.map +1 -0
- package/build/login/methods/types.d.ts +30 -0
- package/build/login/methods/types.d.ts.map +1 -0
- package/build/login/methods/types.js +2 -0
- package/build/login/methods/types.js.map +1 -0
- package/build/login/methods.d.ts +7 -0
- package/build/login/methods.d.ts.map +1 -0
- package/build/login/methods.js +87 -0
- package/build/login/methods.js.map +1 -0
- package/build/login/resume/types.d.ts +24 -0
- package/build/login/resume/types.d.ts.map +1 -0
- package/build/login/resume/types.js +2 -0
- package/build/login/resume/types.js.map +1 -0
- package/build/login/resume.d.ts +9 -0
- package/build/login/resume.d.ts.map +1 -0
- package/build/login/resume.js +38 -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 +66 -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 +210 -0
- package/build/login/service.js.map +1 -0
- package/build/login/start/types.d.ts +29 -0
- package/build/login/start/types.d.ts.map +1 -0
- package/build/login/start/types.js +2 -0
- package/build/login/start/types.js.map +1 -0
- package/build/login/start.d.ts +5 -0
- package/build/login/start.d.ts.map +1 -0
- package/build/login/start.js +36 -0
- package/build/login/start.js.map +1 -0
- package/build/login/surrogate/types.d.ts +9 -0
- package/build/login/surrogate/types.d.ts.map +1 -0
- package/build/login/surrogate/types.js +2 -0
- package/build/login/surrogate/types.js.map +1 -0
- package/build/login/surrogate.d.ts +13 -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/types.d.ts +112 -0
- package/build/login/terms/types.d.ts.map +1 -0
- package/build/login/terms/types.js +2 -0
- package/build/login/terms/types.js.map +1 -0
- package/build/login/terms-config.d.ts +65 -0
- package/build/login/terms-config.d.ts.map +1 -0
- package/build/login/terms-config.js +2 -0
- package/build/login/terms-config.js.map +1 -0
- package/build/login/terms.d.ts +21 -0
- package/build/login/terms.d.ts.map +1 -0
- package/build/login/terms.js +235 -0
- package/build/login/terms.js.map +1 -0
- package/build/login/types.d.ts +313 -0
- package/build/login/types.d.ts.map +1 -0
- package/build/login/types.js +2 -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 +11 -0
- package/build/manager/entrypoints.d.ts.map +1 -0
- package/build/manager/entrypoints.js +17 -0
- 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 +3 -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 +2 -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/types.d.ts +10 -0
- package/build/manager/plugins/registry/types.d.ts.map +1 -0
- package/build/manager/plugins/registry/types.js +2 -0
- package/build/manager/plugins/registry/types.js.map +1 -0
- 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 +23 -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 +10 -3
- 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 +39 -29
- package/src/components/dispatcher/component.tsx +37 -14
- package/src/components/dispatcher/types.local.ts +7 -0
- package/src/entrypoints.ts +10 -0
- package/src/helper.ts +31 -5
- package/src/index.ts +1 -1
- package/src/login/adopt/types.ts +25 -0
- package/src/login/adopt.ts +26 -0
- package/src/login/consts.local.ts +34 -0
- package/src/login/consts.ts +124 -0
- package/src/login/credit/types.ts +6 -0
- package/src/login/credit.ts +69 -0
- package/src/login/env/types.ts +35 -0
- package/src/login/env.ts +74 -0
- package/src/login/flow.ts +44 -0
- package/src/login/hook.ts +99 -0
- package/src/login/i18n/be.json +41 -0
- package/src/login/i18n/de.json +41 -0
- package/src/login/i18n/en.json +41 -0
- package/src/login/i18n/es.json +41 -0
- package/src/login/i18n/fr.json +41 -0
- package/src/login/i18n/pl.json +41 -0
- package/src/login/i18n/ru.json +41 -0
- package/src/login/i18n/uk.json +41 -0
- package/src/login/i18n.ts +29 -0
- package/src/login/index.ts +27 -0
- package/src/login/land/types.ts +54 -0
- package/src/login/land.ts +149 -0
- package/src/login/methods/types.ts +32 -0
- package/src/login/methods.ts +109 -0
- package/src/login/resume/types.ts +24 -0
- package/src/login/resume.ts +45 -0
- package/src/login/screen.tsx +140 -0
- package/src/login/service.ts +271 -0
- package/src/login/start/types.ts +30 -0
- package/src/login/start.ts +44 -0
- package/src/login/surrogate/types.ts +9 -0
- package/src/login/surrogate.ts +37 -0
- package/src/login/terms/types.ts +126 -0
- package/src/login/terms-config.ts +55 -0
- package/src/login/terms.ts +315 -0
- package/src/login/types.ts +335 -0
- package/src/manager/README.md +37 -80
- 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/entrypoints.ts +18 -0
- package/src/manager/plugins/basic-ed25519.tsx +7 -0
- package/src/manager/plugins/exports.ts +3 -0
- package/src/manager/plugins/index.ts +11 -4
- package/src/manager/plugins/methods.ts +74 -0
- package/src/manager/plugins/re-captcha.tsx +7 -0
- package/src/manager/plugins/registry/types.ts +10 -0
- package/src/manager/plugins/registry.ts +33 -0
- package/src/manager/plugins/tunnel-consumer.tsx +12 -3
- package/src/manager/plugins/types.ts +54 -0
- package/src/service.ts +1 -1
- package/tests/context.ts +1 -2
- package/tests/i18n.spec.ts +68 -0
- package/tests/land.spec.ts +292 -0
- package/tests/login.spec.ts +332 -0
- package/tests/target.spec.ts +210 -0
- package/tests/terms-deferred.spec.ts +65 -0
- package/tests/terms.spec.ts +314 -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 +0 -16
- package/build/manager/modules.js.map +0 -1
- package/build/modules.d.ts +0 -4
- package/build/modules.d.ts.map +0 -1
- package/build/modules.js +0 -9
- package/build/modules.js.map +0 -1
- package/src/manager/modules.ts +0 -18
- package/src/modules.ts +0 -13
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/login/credit/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { BrandSettings, LoginCreditConfig } from '@owlmeans/config';
|
|
2
|
+
import type { ResolvedCredit } from './credit/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* What the bottom of the sign-in screen says.
|
|
5
|
+
*
|
|
6
|
+
* It is a copyright notice, so it is composed as one: `© <year> <holder>`. That is the whole
|
|
7
|
+
* reason `copyright` defaults to on — the name on its own reads as a caption, and an application
|
|
8
|
+
* that means to assert a copyright would have had to write the mark and the year into a literal
|
|
9
|
+
* `line` to get one.
|
|
10
|
+
*
|
|
11
|
+
* The organization falls back to its slug because an organization record carries no readable name
|
|
12
|
+
* — so "no name" is the ordinary case, not an error, and a screen that rendered an empty line for
|
|
13
|
+
* it would be worse than one that renders the slug.
|
|
14
|
+
*
|
|
15
|
+
* `line` replaces everything when an app supplies it: a product with its own legal wording should
|
|
16
|
+
* not have to defeat a composition rule to use it.
|
|
17
|
+
*/
|
|
18
|
+
export declare const resolveCredit: (cfg?: LoginCreditConfig, brand?: BrandSettings, service?: string) => ResolvedCredit;
|
|
19
|
+
//# sourceMappingURL=credit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credit.d.ts","sourceRoot":"","sources":["../../src/login/credit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAuBvD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,aAAa,SAClB,iBAAiB,UAAU,aAAa,YAAY,MAAM,KAC/D,cA2BF,CAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The years one notice covers.
|
|
3
|
+
*
|
|
4
|
+
* A range only while the first year is genuinely in the past — an app configured with the current
|
|
5
|
+
* year, or with a year a skewed clock puts in the future, still gets a well-formed notice rather
|
|
6
|
+
* than `© 2026–2026` or a range that runs backwards.
|
|
7
|
+
*/
|
|
8
|
+
const years = (since, now) => since != null && since > 0 && since < now ? `${since}–${now}` : `${now}`;
|
|
9
|
+
/**
|
|
10
|
+
* A configured value that was actually SET.
|
|
11
|
+
*
|
|
12
|
+
* Empty is how a build-time default spells "unset", and this config is filled from environment
|
|
13
|
+
* variables a platform delivers — `BRANDING_ORGANIZATION: meta.brandingOrganization ?? ''` is the
|
|
14
|
+
* shape of every one of them. `??` does not fall through an empty string, so an undelivered
|
|
15
|
+
* organization used to win the fallback chain and compose a line ending in a bare dash.
|
|
16
|
+
*/
|
|
17
|
+
const set = (value) => value != null && value.trim() !== '' ? value : null;
|
|
18
|
+
/**
|
|
19
|
+
* What the bottom of the sign-in screen says.
|
|
20
|
+
*
|
|
21
|
+
* It is a copyright notice, so it is composed as one: `© <year> <holder>`. That is the whole
|
|
22
|
+
* reason `copyright` defaults to on — the name on its own reads as a caption, and an application
|
|
23
|
+
* that means to assert a copyright would have had to write the mark and the year into a literal
|
|
24
|
+
* `line` to get one.
|
|
25
|
+
*
|
|
26
|
+
* The organization falls back to its slug because an organization record carries no readable name
|
|
27
|
+
* — so "no name" is the ordinary case, not an error, and a screen that rendered an empty line for
|
|
28
|
+
* it would be worse than one that renders the slug.
|
|
29
|
+
*
|
|
30
|
+
* `line` replaces everything when an app supplies it: a product with its own legal wording should
|
|
31
|
+
* not have to defeat a composition rule to use it.
|
|
32
|
+
*/
|
|
33
|
+
export const resolveCredit = (cfg, brand, service) => {
|
|
34
|
+
const poweredBy = cfg?.poweredBy ?? true;
|
|
35
|
+
const literal = set(cfg?.line);
|
|
36
|
+
if (literal != null) {
|
|
37
|
+
return { poweredBy, line: literal };
|
|
38
|
+
}
|
|
39
|
+
const product = set(cfg?.product) ?? set(brand?.name) ?? set(service);
|
|
40
|
+
const organization = set(cfg?.organization) ?? set(brand?.organization)
|
|
41
|
+
?? set(cfg?.entity) ?? set(brand?.entity);
|
|
42
|
+
// Whoever the notice names. A product with no organization behind it holds its own copyright,
|
|
43
|
+
// which is why this falls through to the product rather than dropping the notice.
|
|
44
|
+
const holder = set(cfg?.holder) ?? organization ?? product;
|
|
45
|
+
const wording = typeof cfg?.copyright === 'string' ? set(cfg.copyright) : null;
|
|
46
|
+
const notice = cfg?.copyright === false || holder == null
|
|
47
|
+
? organization
|
|
48
|
+
: wording ?? `© ${years(cfg?.since, new Date().getFullYear())} ${holder}`;
|
|
49
|
+
// The product is named beside the notice only when it is not already the thing being claimed —
|
|
50
|
+
// "OwlMeans — © 2026 OwlMeans" says the name twice and neither time usefully.
|
|
51
|
+
return {
|
|
52
|
+
poweredBy,
|
|
53
|
+
line: product != null && notice != null && product !== holder
|
|
54
|
+
? `${product} — ${notice}`
|
|
55
|
+
: notice ?? product,
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=credit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credit.js","sourceRoot":"","sources":["../../src/login/credit.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,MAAM,KAAK,GAAG,CAAC,KAAyB,EAAE,GAAW,EAAU,EAAE,CAC/D,KAAK,IAAI,IAAI,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,EAAE,CAAA;AAE1E;;;;;;;GAOG;AACH,MAAM,GAAG,GAAG,CAAC,KAAqB,EAAiB,EAAE,CACnD,KAAK,IAAI,IAAI,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAA;AAErD;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,GAAuB,EAAE,KAAqB,EAAE,OAAgB,EAChD,EAAE;IAClB,MAAM,SAAS,GAAG,GAAG,EAAE,SAAS,IAAI,IAAI,CAAA;IACxC,MAAM,OAAO,GAAG,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IAC9B,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;QACpB,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA;IACrC,CAAC;IAED,MAAM,OAAO,GAAG,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,CAAA;IACrE,MAAM,YAAY,GAAG,GAAG,CAAC,GAAG,EAAE,YAAY,CAAC,IAAI,GAAG,CAAC,KAAK,EAAE,YAAY,CAAC;WAClE,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;IAE3C,8FAA8F;IAC9F,kFAAkF;IAClF,MAAM,MAAM,GAAG,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,YAAY,IAAI,OAAO,CAAA;IAC1D,MAAM,OAAO,GAAG,OAAO,GAAG,EAAE,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IAC9E,MAAM,MAAM,GAAG,GAAG,EAAE,SAAS,KAAK,KAAK,IAAI,MAAM,IAAI,IAAI;QACvD,CAAC,CAAC,YAAY;QACd,CAAC,CAAC,OAAO,IAAI,KAAK,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,IAAI,MAAM,EAAE,CAAA;IAE3E,+FAA+F;IAC/F,8EAA8E;IAC9E,OAAO;QACL,SAAS;QACT,IAAI,EAAE,OAAO,IAAI,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,OAAO,KAAK,MAAM;YAC3D,CAAC,CAAC,GAAG,OAAO,MAAM,MAAM,EAAE;YAC1B,CAAC,CAAC,MAAM,IAAI,OAAO;KACtB,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { LoginEnv } from '../types.js';
|
|
2
|
+
/** What this browsing context is for a sign-in: framed, the surrogate window, opened by another. */
|
|
3
|
+
export interface LoginEnvHelper {
|
|
4
|
+
/**
|
|
5
|
+
* Whether this document is embedded in a frame.
|
|
6
|
+
*
|
|
7
|
+
* Reading `window.top` across origins throws, and that throw is itself the answer: a `top` that
|
|
8
|
+
* differs and a `top` that cannot be reached both mean "framed".
|
|
9
|
+
*/
|
|
10
|
+
isEmbedded: () => boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Record that this window is the surrogate login window, while that is still knowable.
|
|
13
|
+
*
|
|
14
|
+
* Must run on the surrogate's **first** load, before the flow navigates to the provider:
|
|
15
|
+
* `window.name` is the only evidence at that point, and browsers clear it as soon as a top-level
|
|
16
|
+
* context goes cross-origin — so by the time the provider redirects back, the name is gone and
|
|
17
|
+
* this window would look like an ordinary tab.
|
|
18
|
+
*
|
|
19
|
+
* Idempotent, and a no-op in every window that is not the surrogate.
|
|
20
|
+
*/
|
|
21
|
+
markSurrogate: () => void;
|
|
22
|
+
/** Whether this document is the surrogate login window. */
|
|
23
|
+
isSurrogate: () => boolean;
|
|
24
|
+
/** Forget the surrogate marker — called once its token has been handed back. */
|
|
25
|
+
clearSurrogate: () => void;
|
|
26
|
+
/**
|
|
27
|
+
* Default login environment.
|
|
28
|
+
*
|
|
29
|
+
* The single source of environment truth for cascade selection — a plugin's `match` reads this
|
|
30
|
+
* and never probes `window` itself, so a non-DOM host can drive the same plugins by supplying its
|
|
31
|
+
* own descriptor.
|
|
32
|
+
*/
|
|
33
|
+
defaultLoginEnv: () => LoginEnv;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/login/env/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAE3C,oGAAoG;AACpG,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,UAAU,EAAE,MAAM,OAAO,CAAA;IACzB;;;;;;;;;OASG;IACH,aAAa,EAAE,MAAM,IAAI,CAAA;IACzB,2DAA2D;IAC3D,WAAW,EAAE,MAAM,OAAO,CAAA;IAC1B,gFAAgF;IAChF,cAAc,EAAE,MAAM,IAAI,CAAA;IAC1B;;;;;;OAMG;IACH,eAAe,EAAE,MAAM,QAAQ,CAAA;CAChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/login/env/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { LoginEnvHelper } from './env/types.js';
|
|
2
|
+
export declare const createLoginEnvHelper: () => LoginEnvHelper;
|
|
3
|
+
export declare const loginEnvHelper: LoginEnvHelper;
|
|
4
|
+
/** @deprecated compat:factory-refactor — use `loginEnvHelper.markSurrogate()` */
|
|
5
|
+
export declare const markSurrogate: () => void;
|
|
6
|
+
/** @deprecated compat:factory-refactor — use `loginEnvHelper.clearSurrogate()` */
|
|
7
|
+
export declare const clearSurrogate: () => void;
|
|
8
|
+
//# sourceMappingURL=env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/login/env.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,eAAO,MAAM,oBAAoB,QAAO,cA6DvC,CAAA;AAED,eAAO,MAAM,cAAc,gBAAyB,CAAA;AAEpD,iFAAiF;AACjF,eAAO,MAAM,aAAa,QAAO,IAAsC,CAAA;AAEvE,kFAAkF;AAClF,eAAO,MAAM,cAAc,QAAO,IAAuC,CAAA"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { LOGIN_SURROGATE_MARKER, LOGIN_SURROGATE_NAME } from './consts.js';
|
|
2
|
+
export const createLoginEnvHelper = () => {
|
|
3
|
+
const isEmbedded = () => {
|
|
4
|
+
try {
|
|
5
|
+
return window.self !== window.top;
|
|
6
|
+
}
|
|
7
|
+
catch {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
const markSurrogate = () => {
|
|
12
|
+
if (typeof window === 'undefined' || window.name !== LOGIN_SURROGATE_NAME) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
window.sessionStorage.setItem(LOGIN_SURROGATE_MARKER, '1');
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
// Storage can be unavailable (private modes, blocked cookies). The `window.name` check still
|
|
20
|
+
// covers the case where nothing cross-origin happened in between.
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const isSurrogate = () => {
|
|
24
|
+
if (typeof window === 'undefined') {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
if (window.name === LOGIN_SURROGATE_NAME) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
return window.sessionStorage.getItem(LOGIN_SURROGATE_MARKER) === '1';
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const clearSurrogate = () => {
|
|
38
|
+
if (typeof window === 'undefined') {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
window.sessionStorage.removeItem(LOGIN_SURROGATE_MARKER);
|
|
43
|
+
}
|
|
44
|
+
catch { /* nothing to clean up if storage was never available */ }
|
|
45
|
+
};
|
|
46
|
+
const defaultLoginEnv = () => {
|
|
47
|
+
const hasWindow = typeof window !== 'undefined';
|
|
48
|
+
if (!hasWindow) {
|
|
49
|
+
return { hasWindow, embedded: false, surrogate: false, hasOpener: false };
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
hasWindow,
|
|
53
|
+
embedded: isEmbedded(),
|
|
54
|
+
surrogate: isSurrogate(),
|
|
55
|
+
// `Cross-Origin-Opener-Policy: same-origin` from the provider severs this permanently, which
|
|
56
|
+
// is why it is observed rather than assumed from "we were opened by someone".
|
|
57
|
+
hasOpener: window.opener != null,
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
return { isEmbedded, markSurrogate, isSurrogate, clearSurrogate, defaultLoginEnv };
|
|
61
|
+
};
|
|
62
|
+
export const loginEnvHelper = createLoginEnvHelper();
|
|
63
|
+
/** @deprecated compat:factory-refactor — use `loginEnvHelper.markSurrogate()` */
|
|
64
|
+
export const markSurrogate = () => loginEnvHelper.markSurrogate();
|
|
65
|
+
/** @deprecated compat:factory-refactor — use `loginEnvHelper.clearSurrogate()` */
|
|
66
|
+
export const clearSurrogate = () => loginEnvHelper.clearSurrogate();
|
|
67
|
+
//# sourceMappingURL=env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/login/env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAI1E,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAmB,EAAE;IACvD,MAAM,UAAU,GAAG,GAAY,EAAE;QAC/B,IAAI,CAAC;YACH,OAAO,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,GAAG,CAAA;QACnC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAA;QACb,CAAC;IACH,CAAC,CAAA;IAED,MAAM,aAAa,GAAG,GAAS,EAAE;QAC/B,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,IAAI,KAAK,oBAAoB,EAAE,CAAC;YAC1E,OAAM;QACR,CAAC;QACD,IAAI,CAAC;YACH,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAA;QAC5D,CAAC;QAAC,MAAM,CAAC;YACP,6FAA6F;YAC7F,kEAAkE;QACpE,CAAC;IACH,CAAC,CAAA;IAED,MAAM,WAAW,GAAG,GAAY,EAAE;QAChC,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;YAClC,OAAO,KAAK,CAAA;QACd,CAAC;QACD,IAAI,MAAM,CAAC,IAAI,KAAK,oBAAoB,EAAE,CAAC;YACzC,OAAO,IAAI,CAAA;QACb,CAAC;QACD,IAAI,CAAC;YACH,OAAO,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,sBAAsB,CAAC,KAAK,GAAG,CAAA;QACtE,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAA;QACd,CAAC;IACH,CAAC,CAAA;IAED,MAAM,cAAc,GAAG,GAAS,EAAE;QAChC,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;YAClC,OAAM;QACR,CAAC;QACD,IAAI,CAAC;YACH,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAA;QAC1D,CAAC;QAAC,MAAM,CAAC,CAAC,wDAAwD,CAAC,CAAC;IACtE,CAAC,CAAA;IAED,MAAM,eAAe,GAAG,GAAa,EAAE;QACrC,MAAM,SAAS,GAAG,OAAO,MAAM,KAAK,WAAW,CAAA;QAC/C,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,CAAA;QAC3E,CAAC;QAED,OAAO;YACL,SAAS;YACT,QAAQ,EAAE,UAAU,EAAE;YACtB,SAAS,EAAE,WAAW,EAAE;YACxB,6FAA6F;YAC7F,8EAA8E;YAC9E,SAAS,EAAE,MAAM,CAAC,MAAM,IAAI,IAAI;SACjC,CAAA;IACH,CAAC,CAAA;IAED,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,CAAA;AACpF,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,oBAAoB,EAAE,CAAA;AAEpD,iFAAiF;AACjF,MAAM,CAAC,MAAM,aAAa,GAAG,GAAS,EAAE,CAAC,cAAc,CAAC,aAAa,EAAE,CAAA;AAEvE,kFAAkF;AAClF,MAAM,CAAC,MAAM,cAAc,GAAG,GAAS,EAAE,CAAC,cAAc,CAAC,cAAc,EAAE,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { FlowModel } from '@owlmeans/flow';
|
|
2
|
+
/**
|
|
3
|
+
* Bring a freshly booted standard OIDC flow to the step an authorization request can be made from.
|
|
4
|
+
*
|
|
5
|
+
* `stdOidcFlow` starts at `Dispatch`, but `OidcAuthService.authenticate` refuses any state that is
|
|
6
|
+
* not `Ephemeral` and returns null — so an application whose flow was only booted can ask for an
|
|
7
|
+
* authorization URL all day and be told nothing, forever. The dispatcher in this package has always
|
|
8
|
+
* done this transition inline; a relying party that replaces that dispatcher (`web-oidc-rp`,
|
|
9
|
+
* `mui-oidc-rp`) inherited the requirement without the code, which is what left a sign-in button
|
|
10
|
+
* that reported no error and did nothing at all.
|
|
11
|
+
*
|
|
12
|
+
* `Ephemeral` is the branch for an application that is its OWN authority — its flow configuration
|
|
13
|
+
* maps the auth service to a placeholder, which is exactly the generated-application case. An app
|
|
14
|
+
* federated with a real auth service keeps its target and is left alone.
|
|
15
|
+
*
|
|
16
|
+
* Idempotent, and safe to call on every attempt: a flow already past `Dispatch`, or one that is
|
|
17
|
+
* not the standard OIDC flow at all, is returned untouched.
|
|
18
|
+
*/
|
|
19
|
+
export declare const enterOidcAuthorization: (model: FlowModel) => FlowModel;
|
|
20
|
+
//# sourceMappingURL=flow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow.d.ts","sourceRoot":"","sources":["../../src/login/flow.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAG/C;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,sBAAsB,UAAW,SAAS,KAAG,SAsBzD,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { FLOW_PLACEHOLDER, OidcAuthStep, STD_OIDC_FLOW } from '@owlmeans/flow';
|
|
2
|
+
import { DEFAULT_ENTITY } from '../consts.js';
|
|
3
|
+
/**
|
|
4
|
+
* Bring a freshly booted standard OIDC flow to the step an authorization request can be made from.
|
|
5
|
+
*
|
|
6
|
+
* `stdOidcFlow` starts at `Dispatch`, but `OidcAuthService.authenticate` refuses any state that is
|
|
7
|
+
* not `Ephemeral` and returns null — so an application whose flow was only booted can ask for an
|
|
8
|
+
* authorization URL all day and be told nothing, forever. The dispatcher in this package has always
|
|
9
|
+
* done this transition inline; a relying party that replaces that dispatcher (`web-oidc-rp`,
|
|
10
|
+
* `mui-oidc-rp`) inherited the requirement without the code, which is what left a sign-in button
|
|
11
|
+
* that reported no error and did nothing at all.
|
|
12
|
+
*
|
|
13
|
+
* `Ephemeral` is the branch for an application that is its OWN authority — its flow configuration
|
|
14
|
+
* maps the auth service to a placeholder, which is exactly the generated-application case. An app
|
|
15
|
+
* federated with a real auth service keeps its target and is left alone.
|
|
16
|
+
*
|
|
17
|
+
* Idempotent, and safe to call on every attempt: a flow already past `Dispatch`, or one that is
|
|
18
|
+
* not the standard OIDC flow at all, is returned untouched.
|
|
19
|
+
*/
|
|
20
|
+
export const enterOidcAuthorization = (model) => {
|
|
21
|
+
const state = model.state();
|
|
22
|
+
if (state.flow !== STD_OIDC_FLOW || state.step !== OidcAuthStep.Dispatch) {
|
|
23
|
+
return model;
|
|
24
|
+
}
|
|
25
|
+
const target = model.step().service;
|
|
26
|
+
if (state.service == null || state.service === '') {
|
|
27
|
+
model.target(target);
|
|
28
|
+
}
|
|
29
|
+
// The entity travels to this app's own backend, which resolves its default provider by `def`
|
|
30
|
+
// alone. It still has to BE there: the init endpoint rejects a body without one.
|
|
31
|
+
if (state.entityId == null) {
|
|
32
|
+
model.entity(DEFAULT_ENTITY);
|
|
33
|
+
}
|
|
34
|
+
if (target === FLOW_PLACEHOLDER) {
|
|
35
|
+
model.transit(OidcAuthStep.Ephemeral, true);
|
|
36
|
+
}
|
|
37
|
+
return model;
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=flow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow.js","sourceRoot":"","sources":["../../src/login/flow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAE9E,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE7C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAgB,EAAa,EAAE;IACpE,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,EAAE,CAAA;IAC3B,IAAI,KAAK,CAAC,IAAI,KAAK,aAAa,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,CAAC,QAAQ,EAAE,CAAC;QACzE,OAAO,KAAK,CAAA;IACd,CAAC;IAED,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,OAAO,CAAA;IACnC,IAAI,KAAK,CAAC,OAAO,IAAI,IAAI,IAAI,KAAK,CAAC,OAAO,KAAK,EAAE,EAAE,CAAC;QAClD,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IACtB,CAAC;IAED,6FAA6F;IAC7F,iFAAiF;IACjF,IAAI,KAAK,CAAC,QAAQ,IAAI,IAAI,EAAE,CAAC;QAC3B,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC,CAAA;IAC9B,CAAC;IAED,IAAI,MAAM,KAAK,gBAAgB,EAAE,CAAC;QAChC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;IAC7C,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC,CAAA"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type MouseEvent } from 'react';
|
|
2
|
+
import type { LandOptions } from './land/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Wiring for a "Log in" control: where it points, and what it does when clicked.
|
|
5
|
+
*
|
|
6
|
+
* The caller renders one control and attaches one handler — which browsing context the flow can
|
|
7
|
+
* actually complete in is the login service's problem, not the app's. An ordinary tab redirects;
|
|
8
|
+
* an app embedded in a frame runs the flow one window up, because the provider refuses to be
|
|
9
|
+
* framed and its cookies are third-party there.
|
|
10
|
+
*
|
|
11
|
+
* `target` is the screen to land on once signed in — sign-in FIRST, then the screen, in an ordinary
|
|
12
|
+
* tab and in a framed application alike, with any pending post-sign-in step (a consent screen) run
|
|
13
|
+
* on the way. The control still leads to the dispatcher; the target is parked for the landing
|
|
14
|
+
* (`LoginRequest.target`), and somebody already signed in goes straight to it (`loginStartOf(ctx).startLogin`).
|
|
15
|
+
* Without a target the landing is the ordinary one.
|
|
16
|
+
*
|
|
17
|
+
* The returned handler is deliberately NOT async and awaits nothing before delegating: a window
|
|
18
|
+
* opened after the user gesture has finished being handled is eaten by the popup blocker.
|
|
19
|
+
*
|
|
20
|
+
* The dispatcher entrypoint is resolved INSIDE the hook, never at module scope. Module bodies run
|
|
21
|
+
* while the app is still being imported, before `registerEntrypoints` has put anything on the
|
|
22
|
+
* context, and a top-level lookup throws `Entrypoint dispatcher not found` — which escapes during
|
|
23
|
+
* import, takes the whole render down, and paints an empty page with no component at fault.
|
|
24
|
+
*/
|
|
25
|
+
export declare const useLogin: (target?: string) => readonly [string, (event?: MouseEvent) => void];
|
|
26
|
+
/**
|
|
27
|
+
* Wiring for a "Log out" control.
|
|
28
|
+
*
|
|
29
|
+
* One control, one handler, no decision — the mirror of {@link useLogin}. Where the session has to
|
|
30
|
+
* be ended (here, or one window up in a surrogate whose storage partition this document cannot
|
|
31
|
+
* reach) is the login plugin's call.
|
|
32
|
+
*
|
|
33
|
+
* NOT async, and nothing is awaited before delegating: logging out of a framed application opens a
|
|
34
|
+
* window, and a window opened after the gesture has finished being handled is eaten by the popup
|
|
35
|
+
* blocker. The surrogate entrypoint is resolved INSIDE the hook for the same reason `useLogin`
|
|
36
|
+
* resolves the dispatcher there.
|
|
37
|
+
*
|
|
38
|
+
* The return shape stays a bare handler rather than `useLogin`'s tuple: a logout control has no
|
|
39
|
+
* address to point at, and every generated application carries a copy of a component that writes
|
|
40
|
+
* `const onLogOut = useLogout()`. `(event?: MouseEvent) => void` is assignable to `() => void`, so
|
|
41
|
+
* `onClick={onLogOut}` keeps compiling everywhere.
|
|
42
|
+
*/
|
|
43
|
+
export declare const useLogout: (target?: string) => ((event?: MouseEvent) => void);
|
|
44
|
+
/**
|
|
45
|
+
* For a component that runs its own post-login step (the marketing-consent screen, for one) to
|
|
46
|
+
* call once it is satisfied — moves the flow on to the next step, or the ordinary landing.
|
|
47
|
+
*
|
|
48
|
+
* Not async at the call site by accident of its own — it is a callback a component holds and
|
|
49
|
+
* fires later, so nothing here needs the synchronous-gesture discipline `useLogin`/`useLogout` do.
|
|
50
|
+
*/
|
|
51
|
+
export declare const useContinueLogin: () => ((opts?: LandOptions) => Promise<void>);
|
|
52
|
+
//# sourceMappingURL=hook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../src/login/hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,OAAO,CAAA;AAMpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAMlD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,QAAQ,YAAa,MAAM,KAAG,SAAS,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE,UAAU,KAAK,IAAI,CAcxF,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,SAAS,YAAa,MAAM,KAAG,CAAC,CAAC,KAAK,CAAC,EAAE,UAAU,KAAK,IAAI,CAcxE,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,QAAO,CAAC,CAAC,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAQzE,CAAA"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { useContext, useNavigate } from '@owlmeans/client';
|
|
3
|
+
import { DISPATCHER } from '@owlmeans/auth';
|
|
4
|
+
import { LoginIntent, LOGIN_SERVICE } from './consts.js';
|
|
5
|
+
import { loginLandingOf } from './land.js';
|
|
6
|
+
import { surrogatePath } from './surrogate.js';
|
|
7
|
+
import { loginStartOf } from './start.js';
|
|
8
|
+
/**
|
|
9
|
+
* Wiring for a "Log in" control: where it points, and what it does when clicked.
|
|
10
|
+
*
|
|
11
|
+
* The caller renders one control and attaches one handler — which browsing context the flow can
|
|
12
|
+
* actually complete in is the login service's problem, not the app's. An ordinary tab redirects;
|
|
13
|
+
* an app embedded in a frame runs the flow one window up, because the provider refuses to be
|
|
14
|
+
* framed and its cookies are third-party there.
|
|
15
|
+
*
|
|
16
|
+
* `target` is the screen to land on once signed in — sign-in FIRST, then the screen, in an ordinary
|
|
17
|
+
* tab and in a framed application alike, with any pending post-sign-in step (a consent screen) run
|
|
18
|
+
* on the way. The control still leads to the dispatcher; the target is parked for the landing
|
|
19
|
+
* (`LoginRequest.target`), and somebody already signed in goes straight to it (`loginStartOf(ctx).startLogin`).
|
|
20
|
+
* Without a target the landing is the ordinary one.
|
|
21
|
+
*
|
|
22
|
+
* The returned handler is deliberately NOT async and awaits nothing before delegating: a window
|
|
23
|
+
* opened after the user gesture has finished being handled is eaten by the popup blocker.
|
|
24
|
+
*
|
|
25
|
+
* The dispatcher entrypoint is resolved INSIDE the hook, never at module scope. Module bodies run
|
|
26
|
+
* while the app is still being imported, before `registerEntrypoints` has put anything on the
|
|
27
|
+
* context, and a top-level lookup throws `Entrypoint dispatcher not found` — which escapes during
|
|
28
|
+
* import, takes the whole render down, and paints an empty page with no component at fault.
|
|
29
|
+
*/
|
|
30
|
+
export const useLogin = (target) => {
|
|
31
|
+
const context = useContext();
|
|
32
|
+
const nav = useNavigate();
|
|
33
|
+
const dispatcher = context.entrypoint(DISPATCHER);
|
|
34
|
+
const path = dispatcher.path();
|
|
35
|
+
const onLogin = useCallback((event) => {
|
|
36
|
+
event?.preventDefault();
|
|
37
|
+
void loginStartOf(context).startLogin({
|
|
38
|
+
url: path, target, go: alias => nav.go(alias),
|
|
39
|
+
});
|
|
40
|
+
}, [context, path, target]);
|
|
41
|
+
return [path, onLogin];
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Wiring for a "Log out" control.
|
|
45
|
+
*
|
|
46
|
+
* One control, one handler, no decision — the mirror of {@link useLogin}. Where the session has to
|
|
47
|
+
* be ended (here, or one window up in a surrogate whose storage partition this document cannot
|
|
48
|
+
* reach) is the login plugin's call.
|
|
49
|
+
*
|
|
50
|
+
* NOT async, and nothing is awaited before delegating: logging out of a framed application opens a
|
|
51
|
+
* window, and a window opened after the gesture has finished being handled is eaten by the popup
|
|
52
|
+
* blocker. The surrogate entrypoint is resolved INSIDE the hook for the same reason `useLogin`
|
|
53
|
+
* resolves the dispatcher there.
|
|
54
|
+
*
|
|
55
|
+
* The return shape stays a bare handler rather than `useLogin`'s tuple: a logout control has no
|
|
56
|
+
* address to point at, and every generated application carries a copy of a component that writes
|
|
57
|
+
* `const onLogOut = useLogout()`. `(event?: MouseEvent) => void` is assignable to `() => void`, so
|
|
58
|
+
* `onClick={onLogOut}` keeps compiling everywhere.
|
|
59
|
+
*/
|
|
60
|
+
export const useLogout = (target) => {
|
|
61
|
+
const context = useContext();
|
|
62
|
+
const nav = useNavigate();
|
|
63
|
+
const path = surrogatePath(context, { intent: LoginIntent.Logout });
|
|
64
|
+
return useCallback((event) => {
|
|
65
|
+
event?.preventDefault();
|
|
66
|
+
const login = context.service(LOGIN_SERVICE);
|
|
67
|
+
void login.logout({
|
|
68
|
+
// An application whose entrypoint list predates the surrogate route logs out in place.
|
|
69
|
+
url: path ?? '',
|
|
70
|
+
...(target != null ? { navigate: () => { nav.go(target); } } : {}),
|
|
71
|
+
});
|
|
72
|
+
}, [context, path, target]);
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* For a component that runs its own post-login step (the marketing-consent screen, for one) to
|
|
76
|
+
* call once it is satisfied — moves the flow on to the next step, or the ordinary landing.
|
|
77
|
+
*
|
|
78
|
+
* Not async at the call site by accident of its own — it is a callback a component holds and
|
|
79
|
+
* fires later, so nothing here needs the synchronous-gesture discipline `useLogin`/`useLogout` do.
|
|
80
|
+
*/
|
|
81
|
+
export const useContinueLogin = () => {
|
|
82
|
+
const context = useContext();
|
|
83
|
+
const nav = useNavigate();
|
|
84
|
+
return useCallback(async (opts) => {
|
|
85
|
+
const landing = await loginLandingOf(context).continueLogin(opts);
|
|
86
|
+
await nav.go(landing.alias, { params: landing.params, query: landing.query });
|
|
87
|
+
}, [context, nav]);
|
|
88
|
+
};
|
|
89
|
+
//# sourceMappingURL=hook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hook.js","sourceRoot":"","sources":["../../src/login/hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAmB,MAAM,OAAO,CAAA;AACpD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAG1D,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAG3C,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAEzC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,MAAe,EAAmD,EAAE;IAC3F,MAAM,OAAO,GAAG,UAAU,EAA8B,CAAA;IACxD,MAAM,GAAG,GAAG,WAAW,EAAE,CAAA;IACzB,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAmB,UAAU,CAAC,CAAA;IACnE,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,EAAE,CAAA;IAE9B,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,KAAkB,EAAE,EAAE;QACjD,KAAK,EAAE,cAAc,EAAE,CAAA;QACvB,KAAK,YAAY,CAAC,OAAkC,CAAC,CAAC,UAAU,CAAC;YAC/D,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC;SAC9C,CAAC,CAAA;IACJ,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAA;IAE3B,OAAO,CAAC,IAAI,EAAE,OAAO,CAAU,CAAA;AACjC,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,MAAe,EAAkC,EAAE;IAC3E,MAAM,OAAO,GAAG,UAAU,EAA8B,CAAA;IACxD,MAAM,GAAG,GAAG,WAAW,EAAE,CAAA;IACzB,MAAM,IAAI,GAAG,aAAa,CAAC,OAAkC,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC,CAAA;IAE9F,OAAO,WAAW,CAAC,CAAC,KAAkB,EAAE,EAAE;QACxC,KAAK,EAAE,cAAc,EAAE,CAAA;QACvB,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAe,aAAa,CAAC,CAAA;QAC1D,KAAK,KAAK,CAAC,MAAM,CAAC;YAChB,uFAAuF;YACvF,GAAG,EAAE,IAAI,IAAI,EAAE;YACf,GAAG,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,CAAA,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAClE,CAAC,CAAA;IACJ,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAA;AAC7B,CAAC,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAA4C,EAAE;IAC5E,MAAM,OAAO,GAAG,UAAU,EAA8B,CAAA;IACxD,MAAM,GAAG,GAAG,WAAW,EAAE,CAAA;IAEzB,OAAO,WAAW,CAAC,KAAK,EAAE,IAAkB,EAAE,EAAE;QAC9C,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,OAAkC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;QAC5F,MAAM,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAA;IAC/E,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAA;AACpB,CAAC,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"login": {
|
|
3
|
+
"title": "Уваход",
|
|
4
|
+
"subtitle": "Абярыце спосаб уваходу.",
|
|
5
|
+
"busy": "Адкрываем акно ўваходу…",
|
|
6
|
+
"empty": "Для гэтай праграмы не наладжаны ніводзін спосаб уваходу.",
|
|
7
|
+
"method": {
|
|
8
|
+
"google": "Працягнуць з Google",
|
|
9
|
+
"oidc": "Працягнуць з {{provider}}",
|
|
10
|
+
"oidc-default": "Увайсці / Зарэгістравацца",
|
|
11
|
+
"oidc-client": "Працягнуць з {{provider}}",
|
|
12
|
+
"basic-ed25519": "Увайсці з ключом",
|
|
13
|
+
"pk-supervisor": "Сакрэтны ключ (аператар)",
|
|
14
|
+
"wallet-consumer": "Гаманец OwlMeans ID",
|
|
15
|
+
"one-time-token": "Увайсці па кодзе з ліста",
|
|
16
|
+
"fallback": "Працягнуць з {{method}}"
|
|
17
|
+
},
|
|
18
|
+
"terms": {
|
|
19
|
+
"accept": "Я прачытаў(-ла) і прымаю {{documents}}.",
|
|
20
|
+
"terms": "Умовы карыстання",
|
|
21
|
+
"privacy": "Палітыку прыватнасці",
|
|
22
|
+
"cookies": "Палітыку файлаў cookie",
|
|
23
|
+
"billing": "Умовы аплаты",
|
|
24
|
+
"product": "Умовы прадукту {{product}}",
|
|
25
|
+
"notice": "Як мы апрацоўваем вашы асабістыя дадзеныя: {{notices}}.",
|
|
26
|
+
"revised": "Апошняе абнаўленне: {{date}}",
|
|
27
|
+
"required": "Каб працягнуць, пацвердзіце {{documents}}."
|
|
28
|
+
},
|
|
29
|
+
"consent": {
|
|
30
|
+
"required": "Уваход захоўвае сеансавы файл cookie. Прыміце неабходныя файлы cookie, каб працягнуць."
|
|
31
|
+
},
|
|
32
|
+
"credit": {
|
|
33
|
+
"powered": "Працуе на OwlMeans"
|
|
34
|
+
},
|
|
35
|
+
"error": {
|
|
36
|
+
"failed": "Уваход не завершаны. Паспрабуйце яшчэ раз.",
|
|
37
|
+
"blocked": "Акно ўваходу заблакавана. Націсніце значок заблакаванага ўсплывальнага акна ў адрасным радку браўзера, каб адкрыць яго."
|
|
38
|
+
},
|
|
39
|
+
"orphaned": "Уваход выкананы. Можаце закрыць гэтае акно і вярнуцца ў праграму."
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"login": {
|
|
3
|
+
"title": "Anmelden",
|
|
4
|
+
"subtitle": "Wählen Sie, wie Sie fortfahren möchten.",
|
|
5
|
+
"busy": "Anmeldung wird geöffnet…",
|
|
6
|
+
"empty": "Für diese Anwendung ist keine Anmeldemethode konfiguriert.",
|
|
7
|
+
"method": {
|
|
8
|
+
"google": "Mit Google fortfahren",
|
|
9
|
+
"oidc": "Mit {{provider}} fortfahren",
|
|
10
|
+
"oidc-default": "Anmelden / Registrieren",
|
|
11
|
+
"oidc-client": "Mit {{provider}} fortfahren",
|
|
12
|
+
"basic-ed25519": "Mit einem Schlüssel anmelden",
|
|
13
|
+
"pk-supervisor": "Geheimer Schlüssel (Betreiber)",
|
|
14
|
+
"wallet-consumer": "OwlMeans-ID-Wallet",
|
|
15
|
+
"one-time-token": "Mit einem E-Mail-Code anmelden",
|
|
16
|
+
"fallback": "Mit {{method}} fortfahren"
|
|
17
|
+
},
|
|
18
|
+
"terms": {
|
|
19
|
+
"accept": "Ich habe {{documents}} gelesen und stimme ihnen zu.",
|
|
20
|
+
"terms": "Allgemeinen Geschäftsbedingungen",
|
|
21
|
+
"privacy": "Datenschutzerklärung",
|
|
22
|
+
"cookies": "Cookie-Richtlinie",
|
|
23
|
+
"billing": "Abrechnungsbedingungen",
|
|
24
|
+
"product": "{{product}}-Produktbedingungen",
|
|
25
|
+
"notice": "Wie wir Ihre personenbezogenen Daten verarbeiten: {{notices}}.",
|
|
26
|
+
"revised": "Zuletzt aktualisiert: {{date}}",
|
|
27
|
+
"required": "Bitte bestätigen Sie {{documents}}, um fortzufahren."
|
|
28
|
+
},
|
|
29
|
+
"consent": {
|
|
30
|
+
"required": "Bei der Anmeldung wird ein Sitzungs-Cookie gespeichert. Akzeptieren Sie die notwendigen Cookies, um fortzufahren."
|
|
31
|
+
},
|
|
32
|
+
"credit": {
|
|
33
|
+
"powered": "Betrieben mit OwlMeans"
|
|
34
|
+
},
|
|
35
|
+
"error": {
|
|
36
|
+
"failed": "Die Anmeldung wurde nicht abgeschlossen. Bitte versuchen Sie es erneut.",
|
|
37
|
+
"blocked": "Das Anmeldefenster wurde blockiert. Klicken Sie auf das Symbol für blockierte Pop-ups in der Adressleiste Ihres Browsers, um es zu öffnen."
|
|
38
|
+
},
|
|
39
|
+
"orphaned": "Angemeldet. Sie können dieses Fenster schließen und in der Anwendung fortfahren."
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"login": {
|
|
3
|
+
"title": "Sign in",
|
|
4
|
+
"subtitle": "Choose how you would like to continue.",
|
|
5
|
+
"busy": "Opening sign-in…",
|
|
6
|
+
"empty": "No sign-in method is configured for this application.",
|
|
7
|
+
"method": {
|
|
8
|
+
"google": "Continue with Google",
|
|
9
|
+
"oidc": "Continue with {{provider}}",
|
|
10
|
+
"oidc-default": "Sign in / Sign up",
|
|
11
|
+
"oidc-client": "Continue with {{provider}}",
|
|
12
|
+
"basic-ed25519": "Sign in with a key",
|
|
13
|
+
"pk-supervisor": "Secret key (operator)",
|
|
14
|
+
"wallet-consumer": "OwlMeans ID wallet",
|
|
15
|
+
"one-time-token": "Sign in with an email code",
|
|
16
|
+
"fallback": "Continue with {{method}}"
|
|
17
|
+
},
|
|
18
|
+
"terms": {
|
|
19
|
+
"accept": "I have read and agree to the {{documents}}.",
|
|
20
|
+
"terms": "Terms & Conditions",
|
|
21
|
+
"privacy": "Privacy Policy",
|
|
22
|
+
"cookies": "Cookie Policy",
|
|
23
|
+
"billing": "Billing Terms",
|
|
24
|
+
"product": "{{product}} Product Terms",
|
|
25
|
+
"notice": "How we handle your personal data: {{notices}}.",
|
|
26
|
+
"revised": "Last updated: {{date}}",
|
|
27
|
+
"required": "Please confirm the {{documents}} to continue."
|
|
28
|
+
},
|
|
29
|
+
"consent": {
|
|
30
|
+
"required": "Signing in stores a session cookie. Accept essential cookies to continue."
|
|
31
|
+
},
|
|
32
|
+
"credit": {
|
|
33
|
+
"powered": "Powered by OwlMeans"
|
|
34
|
+
},
|
|
35
|
+
"error": {
|
|
36
|
+
"failed": "Sign-in did not complete. Please try again.",
|
|
37
|
+
"blocked": "The sign-in window was blocked. Click the blocked pop-up icon in your browser's address bar to open it."
|
|
38
|
+
},
|
|
39
|
+
"orphaned": "Signed in. You can close this window and continue in the application."
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"login": {
|
|
3
|
+
"title": "Iniciar sesión",
|
|
4
|
+
"subtitle": "Elige cómo quieres continuar.",
|
|
5
|
+
"busy": "Abriendo el inicio de sesión…",
|
|
6
|
+
"empty": "No hay ningún método de inicio de sesión configurado para esta aplicación.",
|
|
7
|
+
"method": {
|
|
8
|
+
"google": "Continuar con Google",
|
|
9
|
+
"oidc": "Continuar con {{provider}}",
|
|
10
|
+
"oidc-default": "Iniciar sesión / Registrarse",
|
|
11
|
+
"oidc-client": "Continuar con {{provider}}",
|
|
12
|
+
"basic-ed25519": "Iniciar sesión con una clave",
|
|
13
|
+
"pk-supervisor": "Clave secreta (operador)",
|
|
14
|
+
"wallet-consumer": "Cartera OwlMeans ID",
|
|
15
|
+
"one-time-token": "Iniciar sesión con un código por correo",
|
|
16
|
+
"fallback": "Continuar con {{method}}"
|
|
17
|
+
},
|
|
18
|
+
"terms": {
|
|
19
|
+
"accept": "He leído y acepto {{documents}}.",
|
|
20
|
+
"terms": "Términos y Condiciones",
|
|
21
|
+
"privacy": "Política de Privacidad",
|
|
22
|
+
"cookies": "Política de Cookies",
|
|
23
|
+
"billing": "Condiciones de Facturación",
|
|
24
|
+
"product": "Condiciones del Producto {{product}}",
|
|
25
|
+
"notice": "Cómo tratamos tus datos personales: {{notices}}.",
|
|
26
|
+
"revised": "Última actualización: {{date}}",
|
|
27
|
+
"required": "Confirma {{documents}} para continuar."
|
|
28
|
+
},
|
|
29
|
+
"consent": {
|
|
30
|
+
"required": "Iniciar sesión guarda una cookie de sesión. Acepta las cookies esenciales para continuar."
|
|
31
|
+
},
|
|
32
|
+
"credit": {
|
|
33
|
+
"powered": "Con tecnología de OwlMeans"
|
|
34
|
+
},
|
|
35
|
+
"error": {
|
|
36
|
+
"failed": "El inicio de sesión no se completó. Inténtalo de nuevo.",
|
|
37
|
+
"blocked": "Se bloqueó la ventana de inicio de sesión. Haz clic en el icono de ventana emergente bloqueada en la barra de direcciones del navegador para abrirla."
|
|
38
|
+
},
|
|
39
|
+
"orphaned": "Sesión iniciada. Puedes cerrar esta ventana y continuar en la aplicación."
|
|
40
|
+
}
|
|
41
|
+
}
|