@owlmeans/web-client 0.1.18-rc.8 → 0.1.18
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 +247 -43
- package/agent-meta/manifest.json +3 -3
- package/agent-meta/skills/web-client/SKILL.md +67 -56
- package/build/components/dispatcher/component.d.ts.map +1 -1
- package/build/components/dispatcher/component.js +55 -9
- package/build/components/dispatcher/component.js.map +1 -1
- package/build/components/dispatcher/parametrise.d.ts.map +1 -1
- package/build/components/dispatcher/parametrise.js +0 -3
- package/build/components/dispatcher/parametrise.js.map +1 -1
- package/build/components/dispatcher/types.d.ts +2 -2
- package/build/components/dispatcher/types.d.ts.map +1 -1
- package/build/context.d.ts.map +1 -1
- package/build/context.js +0 -1
- package/build/context.js.map +1 -1
- package/build/entrypoints.d.ts +16 -0
- package/build/entrypoints.d.ts.map +1 -0
- package/build/entrypoints.js +20 -0
- package/build/entrypoints.js.map +1 -0
- package/build/errors.d.ts.map +1 -1
- package/build/errors.js.map +1 -1
- package/build/exports.d.ts +3 -2
- package/build/exports.d.ts.map +1 -1
- package/build/exports.js +2 -2
- package/build/exports.js.map +1 -1
- package/build/helper.d.ts.map +1 -1
- package/build/i18n/auth-be.json +32 -0
- package/build/i18n/auth-de.json +32 -0
- package/build/i18n/auth-en.json +32 -0
- package/build/i18n/auth-es.json +32 -0
- package/build/i18n/auth-fr.json +38 -0
- package/build/i18n/auth-pl.json +32 -0
- package/build/i18n/auth-ru.json +32 -0
- package/build/i18n/auth-uk.json +32 -0
- package/build/i18n.js +10 -8
- package/build/i18n.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/consts.d.ts +36 -0
- package/build/login/consts.d.ts.map +1 -1
- package/build/login/consts.js +38 -0
- package/build/login/consts.js.map +1 -1
- package/build/login/consts.local.d.ts +22 -0
- package/build/login/consts.local.d.ts.map +1 -0
- package/build/login/consts.local.js +48 -0
- package/build/login/consts.local.js.map +1 -0
- package/build/login/index.d.ts +4 -0
- package/build/login/index.d.ts.map +1 -1
- package/build/login/index.js +3 -0
- package/build/login/index.js.map +1 -1
- package/build/login/pump.d.ts +20 -0
- package/build/login/pump.d.ts.map +1 -0
- package/build/login/pump.js +46 -0
- package/build/login/pump.js.map +1 -0
- package/build/login/redirect.d.ts.map +1 -1
- package/build/login/redirect.js +17 -1
- package/build/login/redirect.js.map +1 -1
- package/build/login/screen.d.ts +19 -0
- package/build/login/screen.d.ts.map +1 -0
- package/build/login/screen.js +119 -0
- package/build/login/screen.js.map +1 -0
- package/build/login/service.d.ts.map +1 -1
- package/build/login/surrogate.d.ts +16 -0
- package/build/login/surrogate.d.ts.map +1 -1
- package/build/login/surrogate.js +139 -71
- package/build/login/surrogate.js.map +1 -1
- package/build/login/types.d.ts +10 -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/login/view.d.ts +4 -0
- package/build/login/view.d.ts.map +1 -0
- package/build/login/view.js +12 -0
- package/build/login/view.js.map +1 -0
- package/build/main.d.ts +9 -1
- package/build/main.d.ts.map +1 -1
- package/build/main.js +18 -5
- package/build/main.js.map +1 -1
- package/build/middleware.d.ts +1 -1
- package/build/middleware.d.ts.map +1 -1
- package/build/middleware.js +7 -6
- package/build/middleware.js.map +1 -1
- package/build/service.d.ts.map +1 -1
- package/build/service.js +1 -1
- package/build/service.js.map +1 -1
- package/build/types.local.d.ts +5 -0
- package/build/types.local.d.ts.map +1 -0
- package/build/types.local.js +2 -0
- package/build/types.local.js.map +1 -0
- package/package.json +22 -21
- package/src/components/dispatcher/component.tsx +71 -8
- package/src/components/dispatcher/parametrise.tsx +0 -3
- package/src/components/dispatcher/types.ts +2 -2
- package/src/context.ts +0 -2
- package/src/entrypoints.ts +20 -0
- package/src/exports.ts +7 -2
- package/src/i18n/auth-be.json +32 -0
- package/src/i18n/auth-de.json +32 -0
- package/src/i18n/auth-en.json +32 -0
- package/src/i18n/auth-es.json +32 -0
- package/src/i18n/auth-fr.json +38 -0
- package/src/i18n/auth-pl.json +32 -0
- package/src/i18n/auth-ru.json +32 -0
- package/src/i18n/auth-uk.json +32 -0
- package/src/i18n.ts +10 -8
- package/src/index.ts +1 -1
- package/src/login/consts.local.ts +52 -0
- package/src/login/consts.ts +38 -0
- package/src/login/index.ts +4 -0
- package/src/login/pump.ts +53 -0
- package/src/login/redirect.ts +23 -2
- package/src/login/screen.tsx +141 -0
- package/src/login/surrogate.ts +170 -86
- package/src/login/types.ts +10 -0
- package/src/login/view.tsx +22 -0
- package/src/main.tsx +19 -6
- package/src/middleware.ts +9 -12
- package/src/service.ts +1 -1
- package/src/types.local.ts +5 -0
- package/tests/surrogate.spec.ts +74 -0
- package/tsconfig.json +1 -1
- package/src/modules.ts +0 -9
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import { SurrogateStage } from './consts.js';
|
|
3
|
+
/**
|
|
4
|
+
* The whole of what a login window shows.
|
|
5
|
+
*
|
|
6
|
+
* Plain elements and inline styles on purpose. This renders in a popup opened by a `web-panel` app,
|
|
7
|
+
* a `mui-panel` app and a generated Tailwind app alike, and none of their stylesheets is loaded
|
|
8
|
+
* here — a class name would simply do nothing. It is also the reason this component carries no
|
|
9
|
+
* dependency on a UI family at all.
|
|
10
|
+
*/
|
|
11
|
+
export declare const box: CSSProperties;
|
|
12
|
+
export declare const action: CSSProperties;
|
|
13
|
+
export declare const COPY: Record<SurrogateStage, {
|
|
14
|
+
key: string;
|
|
15
|
+
en: string;
|
|
16
|
+
action?: [string, string];
|
|
17
|
+
}>;
|
|
18
|
+
export declare const LOGOUT_COPY: Partial<Record<SurrogateStage, {
|
|
19
|
+
key: string;
|
|
20
|
+
en: string;
|
|
21
|
+
}>>;
|
|
22
|
+
//# sourceMappingURL=consts.local.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.local.d.ts","sourceRoot":"","sources":["../../src/login/consts.local.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C;;;;;;;GAOG;AACH,eAAO,MAAM,GAAG,EAAE,aAGjB,CAAA;AAED,eAAO,MAAM,MAAM,EAAE,aAGpB,CAAA;AAED,eAAO,MAAM,IAAI,EAAE,MAAM,CAAC,cAAc,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAkB/F,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CAUpF,CAAA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { SurrogateStage } from './consts.js';
|
|
2
|
+
/**
|
|
3
|
+
* The whole of what a login window shows.
|
|
4
|
+
*
|
|
5
|
+
* Plain elements and inline styles on purpose. This renders in a popup opened by a `web-panel` app,
|
|
6
|
+
* a `mui-panel` app and a generated Tailwind app alike, and none of their stylesheets is loaded
|
|
7
|
+
* here — a class name would simply do nothing. It is also the reason this component carries no
|
|
8
|
+
* dependency on a UI family at all.
|
|
9
|
+
*/
|
|
10
|
+
export const box = {
|
|
11
|
+
maxWidth: '22rem', margin: '15vh auto', padding: '1.5rem', textAlign: 'center',
|
|
12
|
+
fontFamily: 'system-ui, sans-serif', lineHeight: 1.5,
|
|
13
|
+
};
|
|
14
|
+
export const action = {
|
|
15
|
+
marginTop: '1rem', padding: '.625rem 1.25rem', fontSize: '1rem',
|
|
16
|
+
cursor: 'pointer', borderRadius: '.375rem', border: '1px solid currentColor',
|
|
17
|
+
};
|
|
18
|
+
export const COPY = {
|
|
19
|
+
[SurrogateStage.Working]: { key: 'working', en: 'Signing you in…' },
|
|
20
|
+
[SurrogateStage.Gesture]: {
|
|
21
|
+
key: 'gesture.title', en: 'Continue to sign in.', action: ['gesture.action', 'Sign in'],
|
|
22
|
+
},
|
|
23
|
+
[SurrogateStage.Handing]: { key: 'handing', en: 'Done. Returning to the application…' },
|
|
24
|
+
[SurrogateStage.Orphaned]: {
|
|
25
|
+
key: 'orphaned', en: 'Signed in. You can close this window and continue in the application.',
|
|
26
|
+
action: ['close', 'Close'],
|
|
27
|
+
},
|
|
28
|
+
[SurrogateStage.Failed]: {
|
|
29
|
+
key: 'failed', en: 'That did not complete. You can close this window and try again.',
|
|
30
|
+
action: ['close', 'Close'],
|
|
31
|
+
},
|
|
32
|
+
[SurrogateStage.Standalone]: {
|
|
33
|
+
key: 'standalone.title', en: 'This page is used to sign in from another window.',
|
|
34
|
+
action: ['standalone.action', 'Open the application'],
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
export const LOGOUT_COPY = {
|
|
38
|
+
[SurrogateStage.Working]: { key: 'working', en: 'Signing you out…' },
|
|
39
|
+
[SurrogateStage.Gesture]: { key: 'gesture.title', en: 'Continue to sign out.' },
|
|
40
|
+
[SurrogateStage.Handing]: { key: 'handing', en: 'Signed out. Returning to the application…' },
|
|
41
|
+
[SurrogateStage.Orphaned]: {
|
|
42
|
+
key: 'orphaned', en: 'Signed out. You can close this window.',
|
|
43
|
+
},
|
|
44
|
+
[SurrogateStage.Failed]: {
|
|
45
|
+
key: 'failed', en: 'Sign-out did not complete here. You can close this window.',
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=consts.local.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.local.js","sourceRoot":"","sources":["../../src/login/consts.local.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C;;;;;;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AC;KACtD;CACF,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAiE;IACvF,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE,kBAAkB,EAAE;IACpE,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,EAAE,eAAe,EAAE,EAAE,EAAE,uBAAuB,EAAE;IAC/E,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE,2CAA2C,EAAE;IAC7F,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE;QACzB,GAAG,EAAE,UAAU,EAAE,EAAE,EAAE,wCAAwC;KAC9D;IACD,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE;QACvB,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,4DAA4D;KAChF;CACF,CAAA"}
|
package/build/login/index.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export * from './consts.js';
|
|
2
|
+
export * from './pump.js';
|
|
2
3
|
export * from './redirect.js';
|
|
3
4
|
export * from './surrogate.js';
|
|
5
|
+
export * from './view.js';
|
|
6
|
+
export type * from './types.js';
|
|
7
|
+
export * from './screen.js';
|
|
4
8
|
export * from './service.js';
|
|
5
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/login/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/login/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,mBAAmB,YAAY,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA"}
|
package/build/login/index.js
CHANGED
package/build/login/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/login/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/login/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AAEzB,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { LoginOutcome } from '@owlmeans/client-auth/login';
|
|
2
|
+
/**
|
|
3
|
+
* Wait on a surrogate window until it says something, or goes away.
|
|
4
|
+
*
|
|
5
|
+
* Extracted so login and logout share one implementation rather than two that agree until one of
|
|
6
|
+
* them is changed. Every guard here was a real failure at some point:
|
|
7
|
+
*
|
|
8
|
+
* - the **origin pin** is not decoration — the message carries a bearer token, and a listener that
|
|
9
|
+
* accepted any origin would take one from any page that could reach this window;
|
|
10
|
+
* - the **`settled` latch** stops a second message, or a close racing a message, resolving twice;
|
|
11
|
+
* - the **`closed` poll** is the only exit when the user simply closes the window, because a window
|
|
12
|
+
* the user closes announces nothing at all;
|
|
13
|
+
* - the listener and the interval are removed on every path, including the ones that resolve.
|
|
14
|
+
*/
|
|
15
|
+
export declare const awaitSurrogate: (surrogate: Window, messageType: string, onMessage: (data: {
|
|
16
|
+
type?: string;
|
|
17
|
+
token?: string;
|
|
18
|
+
ok?: boolean;
|
|
19
|
+
}) => Promise<LoginOutcome>) => Promise<LoginOutcome>;
|
|
20
|
+
//# sourceMappingURL=pump.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pump.d.ts","sourceRoot":"","sources":["../../src/login/pump.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAEhF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,cAAc,cACd,MAAM,eACJ,MAAM,aACR,CAAC,IAAI,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,OAAO,CAAA;CAAE,KAAK,OAAO,CAAC,YAAY,CAAC,KAC1F,OAAO,CAAC,YAAY,CAiCrB,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { LOGIN_WATCH_INTERVAL, LoginOutcome } from '@owlmeans/client-auth/login';
|
|
2
|
+
/**
|
|
3
|
+
* Wait on a surrogate window until it says something, or goes away.
|
|
4
|
+
*
|
|
5
|
+
* Extracted so login and logout share one implementation rather than two that agree until one of
|
|
6
|
+
* them is changed. Every guard here was a real failure at some point:
|
|
7
|
+
*
|
|
8
|
+
* - the **origin pin** is not decoration — the message carries a bearer token, and a listener that
|
|
9
|
+
* accepted any origin would take one from any page that could reach this window;
|
|
10
|
+
* - the **`settled` latch** stops a second message, or a close racing a message, resolving twice;
|
|
11
|
+
* - the **`closed` poll** is the only exit when the user simply closes the window, because a window
|
|
12
|
+
* the user closes announces nothing at all;
|
|
13
|
+
* - the listener and the interval are removed on every path, including the ones that resolve.
|
|
14
|
+
*/
|
|
15
|
+
export const awaitSurrogate = async (surrogate, messageType, onMessage) => await new Promise(resolve => {
|
|
16
|
+
let settled = false;
|
|
17
|
+
let watch;
|
|
18
|
+
const finish = (result) => {
|
|
19
|
+
if (settled) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
settled = true;
|
|
23
|
+
window.removeEventListener('message', handler);
|
|
24
|
+
if (watch != null) {
|
|
25
|
+
clearInterval(watch);
|
|
26
|
+
}
|
|
27
|
+
resolve(result);
|
|
28
|
+
};
|
|
29
|
+
function handler(event) {
|
|
30
|
+
if (event.origin !== window.location.origin) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const data = event.data;
|
|
34
|
+
if (data?.type !== messageType) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
void onMessage(data).then(finish).catch(() => finish(LoginOutcome.Failed));
|
|
38
|
+
}
|
|
39
|
+
window.addEventListener('message', handler);
|
|
40
|
+
watch = setInterval(() => {
|
|
41
|
+
if (surrogate.closed) {
|
|
42
|
+
finish(LoginOutcome.Failed);
|
|
43
|
+
}
|
|
44
|
+
}, LOGIN_WATCH_INTERVAL);
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=pump.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pump.js","sourceRoot":"","sources":["../../src/login/pump.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAEhF;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EACjC,SAAiB,EACjB,WAAmB,EACnB,SAA2F,EACpE,EAAE,CAAC,MAAM,IAAI,OAAO,CAAe,OAAO,CAAC,EAAE;IACpE,IAAI,OAAO,GAAG,KAAK,CAAA;IACnB,IAAI,KAAiD,CAAA;IAErD,MAAM,MAAM,GAAG,CAAC,MAAoB,EAAQ,EAAE;QAC5C,IAAI,OAAO,EAAE,CAAC;YACZ,OAAM;QACR,CAAC;QACD,OAAO,GAAG,IAAI,CAAA;QACd,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;QAC9C,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YAClB,aAAa,CAAC,KAAK,CAAC,CAAA;QACtB,CAAC;QACD,OAAO,CAAC,MAAM,CAAC,CAAA;IACjB,CAAC,CAAA;IAED,SAAS,OAAO,CAAC,KAAmB;QAClC,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YAC5C,OAAM;QACR,CAAC;QACD,MAAM,IAAI,GAAG,KAAK,CAAC,IAA8D,CAAA;QACjF,IAAI,IAAI,EAAE,IAAI,KAAK,WAAW,EAAE,CAAC;YAC/B,OAAM;QACR,CAAC;QACD,KAAK,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5E,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;IAC3C,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE;QACvB,IAAI,SAAS,CAAC,MAAM,EAAE,CAAC;YACrB,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAA;QAC7B,CAAC;IACH,CAAC,EAAE,oBAAoB,CAAC,CAAA;AAC1B,CAAC,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redirect.d.ts","sourceRoot":"","sources":["../../src/login/redirect.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"redirect.d.ts","sourceRoot":"","sources":["../../src/login/redirect.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAgB,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAG5E;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,QAAO,WAgDzC,CAAA"}
|
package/build/login/redirect.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LoginOutcome } from '@owlmeans/client-auth/login';
|
|
1
|
+
import { LoginOutcome, loginTokenOf } from '@owlmeans/client-auth/login';
|
|
2
2
|
import { REDIRECT_LOGIN } from './consts.js';
|
|
3
3
|
/**
|
|
4
4
|
* The ordinary login flow: this document leaves for the identity provider and comes back.
|
|
@@ -27,5 +27,21 @@ export const makeRedirectLoginPlugin = () => ({
|
|
|
27
27
|
},
|
|
28
28
|
// Nothing to hand anywhere — the token was issued in the document that will use it.
|
|
29
29
|
complete: async () => LoginOutcome.Passed,
|
|
30
|
+
// `resume` is deliberately NOT implemented. The host defaults to `Passed`, which is "keep the
|
|
31
|
+
// session you already have and carry on" — byte for byte what an ordinary tab has always done.
|
|
32
|
+
// Implementing it here would be the one way to regress every unframed application.
|
|
33
|
+
logout: (ctx, request) => loginTokenOf(ctx).revokeToken().then(async () => {
|
|
34
|
+
if (request.navigate != null) {
|
|
35
|
+
await request.navigate();
|
|
36
|
+
return LoginOutcome.Handled;
|
|
37
|
+
}
|
|
38
|
+
// A reload rather than a client-side navigation: `useOwlAuth` and its kin read through
|
|
39
|
+
// cached values, so the honest way to make a whole application forget a session is to
|
|
40
|
+
// rebuild it. This is what `useLogout` did inline before the mechanic became a plugin.
|
|
41
|
+
window.location.reload();
|
|
42
|
+
return LoginOutcome.Handled;
|
|
43
|
+
}),
|
|
44
|
+
// Nothing to tell anyone — the session was cleared in the document that owned it.
|
|
45
|
+
logoutComplete: async () => LoginOutcome.Passed,
|
|
30
46
|
});
|
|
31
47
|
//# sourceMappingURL=redirect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redirect.js","sourceRoot":"","sources":["../../src/login/redirect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"redirect.js","sourceRoot":"","sources":["../../src/login/redirect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAExE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C;;;;;GAKG;AAC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A;IAC7B,CAAC,CAAC;IAEF,kFAAkF;IAClF,cAAc,EAAE,KAAK,IAAI,EAAE,CAAC,YAAY,CAAC,MAAM;CAChD,CAAC,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type FC } from 'react';
|
|
2
|
+
import { SurrogateLoginStep } from './consts.js';
|
|
3
|
+
/**
|
|
4
|
+
* A sign-in request never reuses the session this window happens to hold.
|
|
5
|
+
*
|
|
6
|
+
* The opener asks for a sign-in only when it has no session its server accepts — and the window it
|
|
7
|
+
* opens does not share its storage: an embedded application's storage is partitioned by the top
|
|
8
|
+
* level site, the popup's is first-party. So the popup can hold a session the server has already
|
|
9
|
+
* REFUSED (its record gone after a restart, revoked, fenced). Handing that back closes the popup
|
|
10
|
+
* at once — a blink — and the opener fails its next request exactly as before, forever, because
|
|
11
|
+
* nothing in the opener can reach the popup's storage to clear it. A fresh round trip costs only
|
|
12
|
+
* redirects while the provider still has a session, and always yields a session the server holds.
|
|
13
|
+
*
|
|
14
|
+
* Only without a dispatcher address is the stored session handed back as it is: there is nothing
|
|
15
|
+
* to authenticate through, and the opener's own 401 handling drops it if it is refused.
|
|
16
|
+
*/
|
|
17
|
+
export declare const surrogateLoginStep: (token: string | null | undefined, next: string | null) => SurrogateLoginStep;
|
|
18
|
+
export declare const SurrogateScreen: FC;
|
|
19
|
+
//# sourceMappingURL=screen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screen.d.ts","sourceRoot":"","sources":["../../src/login/screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoC,KAAK,EAAE,EAAE,MAAM,OAAO,CAAA;AASjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAGhD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB,UAAW,MAAM,GAAG,IAAI,GAAG,SAAS,QAAQ,MAAM,GAAG,IAAI,KAAG,kBAO1F,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,EAyG7B,CAAA"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
3
|
+
import { useContext } from '@owlmeans/client';
|
|
4
|
+
import { useI18nLib } from '@owlmeans/client-i18n';
|
|
5
|
+
import { LoginIntent, LoginOutcome, LOGIN_INTENT_QUERY, LOGIN_METHOD_QUERY, LOGIN_NEXT_QUERY } from '@owlmeans/client-auth/login';
|
|
6
|
+
import { USER_ID } from '@owlmeans/client-auth';
|
|
7
|
+
import { LoginSurrogateView } from './view.js';
|
|
8
|
+
import { SurrogateStage } from './consts.js';
|
|
9
|
+
import { logger } from '@owlmeans/log';
|
|
10
|
+
import { SurrogateLoginStep } from './consts.js';
|
|
11
|
+
const log = logger('web-client:login');
|
|
12
|
+
/**
|
|
13
|
+
* A sign-in request never reuses the session this window happens to hold.
|
|
14
|
+
*
|
|
15
|
+
* The opener asks for a sign-in only when it has no session its server accepts — and the window it
|
|
16
|
+
* opens does not share its storage: an embedded application's storage is partitioned by the top
|
|
17
|
+
* level site, the popup's is first-party. So the popup can hold a session the server has already
|
|
18
|
+
* REFUSED (its record gone after a restart, revoked, fenced). Handing that back closes the popup
|
|
19
|
+
* at once — a blink — and the opener fails its next request exactly as before, forever, because
|
|
20
|
+
* nothing in the opener can reach the popup's storage to clear it. A fresh round trip costs only
|
|
21
|
+
* redirects while the provider still has a session, and always yields a session the server holds.
|
|
22
|
+
*
|
|
23
|
+
* Only without a dispatcher address is the stored session handed back as it is: there is nothing
|
|
24
|
+
* to authenticate through, and the opener's own 401 handling drops it if it is refused.
|
|
25
|
+
*/
|
|
26
|
+
export const surrogateLoginStep = (token, next) => {
|
|
27
|
+
const stored = token != null && token !== '';
|
|
28
|
+
if (!stored) {
|
|
29
|
+
return SurrogateLoginStep.Authenticate;
|
|
30
|
+
}
|
|
31
|
+
return next != null && next !== '' ? SurrogateLoginStep.Forget : SurrogateLoginStep.Resume;
|
|
32
|
+
};
|
|
33
|
+
export const SurrogateScreen = () => {
|
|
34
|
+
const context = useContext();
|
|
35
|
+
const [query] = context.router().useSearchParams();
|
|
36
|
+
const t = useI18nLib('auth');
|
|
37
|
+
const intent = query.get(LOGIN_INTENT_QUERY) === LoginIntent.Logout
|
|
38
|
+
? LoginIntent.Logout
|
|
39
|
+
: LoginIntent.Login;
|
|
40
|
+
const [stage, setStage] = useState(SurrogateStage.Working);
|
|
41
|
+
const [error, setError] = useState();
|
|
42
|
+
const onAction = useCallback(() => {
|
|
43
|
+
if (stage === SurrogateStage.Standalone) {
|
|
44
|
+
window.location.href = '/';
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (stage === SurrogateStage.Gesture) {
|
|
48
|
+
const next = query.get(LOGIN_NEXT_QUERY);
|
|
49
|
+
void context.login().begin({ url: next ?? window.location.href });
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
window.close();
|
|
53
|
+
}, [context, stage, query]);
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
const login = context.service('login-service');
|
|
56
|
+
// First statement, unconditionally: `markSurrogate` reads `window.name`, and the browser
|
|
57
|
+
// clears that the moment this window's top-level context goes cross-origin. Recording it
|
|
58
|
+
// later means recording nothing.
|
|
59
|
+
login.enter();
|
|
60
|
+
const env = login.env();
|
|
61
|
+
if (!env.surrogate) {
|
|
62
|
+
// Somebody opened this address directly, or the window lost its marker. Never navigate on
|
|
63
|
+
// its behalf — offer a link and stop.
|
|
64
|
+
setStage(env.embedded ? SurrogateStage.Gesture : SurrogateStage.Standalone);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const run = async () => {
|
|
68
|
+
const token = await context.auth().authenticated();
|
|
69
|
+
if (intent === LoginIntent.Logout) {
|
|
70
|
+
// Revoked FIRST, before anything can be awaited on a channel that may never answer: a
|
|
71
|
+
// window the user closes half a second later must still have ended the session it opened
|
|
72
|
+
// to end.
|
|
73
|
+
await login.revoke();
|
|
74
|
+
const outcome = await login.logoutComplete();
|
|
75
|
+
setStage(outcome === LoginOutcome.Handled ? SurrogateStage.Handing
|
|
76
|
+
: outcome === LoginOutcome.Orphaned ? SurrogateStage.Orphaned
|
|
77
|
+
: SurrogateStage.Failed);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const next = query.get(LOGIN_NEXT_QUERY);
|
|
81
|
+
const step = surrogateLoginStep(token, next);
|
|
82
|
+
if (step === SurrogateLoginStep.Forget) {
|
|
83
|
+
// Dropped from this window's storage only — the web auth service's own clearing path
|
|
84
|
+
// navigates to the dispatcher, and `next` below is exactly where this window goes anyway.
|
|
85
|
+
const auth = context.auth();
|
|
86
|
+
await auth.store().delete(USER_ID);
|
|
87
|
+
auth.token = undefined;
|
|
88
|
+
auth.auth = undefined;
|
|
89
|
+
}
|
|
90
|
+
if (step === SurrogateLoginStep.Resume && token != null) {
|
|
91
|
+
// Signed in here and nowhere to authenticate afresh: hand what there is to the opener.
|
|
92
|
+
const outcome = await login.resume(token);
|
|
93
|
+
setStage(outcome === LoginOutcome.Handled ? SurrogateStage.Handing
|
|
94
|
+
: outcome === LoginOutcome.Orphaned ? SurrogateStage.Orphaned
|
|
95
|
+
: SurrogateStage.Failed);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
// The dispatcher owns the authorization round trip, and the provider's callback lands there
|
|
99
|
+
// rather than on this route. The method the user already chose travels with it, so the
|
|
100
|
+
// dispatcher does not ask a second time in a window with no one to ask.
|
|
101
|
+
if (next == null || next === '') {
|
|
102
|
+
setStage(SurrogateStage.Gesture);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const method = query.get(LOGIN_METHOD_QUERY);
|
|
106
|
+
const target = method != null && method !== ''
|
|
107
|
+
? `${next}${next.includes('?') ? '&' : '?'}${LOGIN_METHOD_QUERY}=${encodeURIComponent(method)}`
|
|
108
|
+
: next;
|
|
109
|
+
window.location.href = target;
|
|
110
|
+
};
|
|
111
|
+
void run().catch((e) => {
|
|
112
|
+
log.error('Surrogate login failed', e);
|
|
113
|
+
setError(e.message);
|
|
114
|
+
setStage(SurrogateStage.Failed);
|
|
115
|
+
});
|
|
116
|
+
}, [context, intent]);
|
|
117
|
+
return _jsx(LoginSurrogateView, { stage: stage, intent: intent, onAction: onAction, error: error, translate: (key, defaultValue) => t(key, { defaultValue }) });
|
|
118
|
+
};
|
|
119
|
+
//# sourceMappingURL=screen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screen.js","sourceRoot":"","sources":["../../src/login/screen.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAW,MAAM,OAAO,CAAA;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,gBAAgB,EAAqB,MAAM,6BAA6B,CAAA;AACpJ,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAEhD,MAAM,GAAG,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAA;AACtC;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAgC,EAAE,IAAmB,EAAsB,EAAE;IAC9G,MAAM,MAAM,GAAG,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,EAAE,CAAA;IAC5C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,kBAAkB,CAAC,YAAY,CAAA;IACxC,C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CAAC,IAAI,CAAA;YACR,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,MAAM,CAAA;QAC/B,CAAC,CAAA;QAED,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAQ,EAAE,EAAE;YAC5B,GAAG,CAAC,KAAK,CAAC,wBAAwB,EAAE,CAAC,CAAC,CAAA;YACtC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;YACnB,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;QACjC,CAAC,CAAC,CAAA;IACJ,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAA;IAErB,OAAO,KAAC,kBAAkB,IACxB,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAC9D,SAAS,EAAE,CAAC,GAAG,EAAE,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,YAAY,EAAE,CAAC,GAC1D,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/login/service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAIlE;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,WAAW,EAAE,CAAC,SAAS,YAAY,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/login/service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAIlE;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,WAAW,EAAE,CAAC,SAAS,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,KAAG,CAMzF,CAAA"}
|
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
import type { LoginPlugin } from '@owlmeans/client-auth/login';
|
|
2
|
+
/**
|
|
3
|
+
* `window.open` features that size and CENTER the surrogate on the screen the browser window
|
|
4
|
+
* currently occupies.
|
|
5
|
+
*
|
|
6
|
+
* Computed fresh per call, never a constant: centering depends on where the browser window sits
|
|
7
|
+
* NOW, which can change between one login attempt and the next. `screenLeft`/`screenTop` and
|
|
8
|
+
* `outerWidth`/`outerHeight` describe the browser's own chrome rather than this document's
|
|
9
|
+
* viewport — and, unlike `innerWidth` or anything reached through `window.top`, they stay readable
|
|
10
|
+
* from a cross-origin iframe. That matters here specifically: a generated app's preview runs
|
|
11
|
+
* framed on a different origin than the manager that embeds it, so `env.embedded` is exactly the
|
|
12
|
+
* case where `window.top.innerWidth` would throw, and reading this document's own `innerWidth`
|
|
13
|
+
* instead would center the popup on the IFRAME's rectangle rather than on the actual window a
|
|
14
|
+
* person sees. Falling back to `window.screen` covers a window that reports no outer geometry at
|
|
15
|
+
* all (a headless test runner).
|
|
16
|
+
*/
|
|
17
|
+
export declare const centeredPopupFeatures: (width: number, height: number) => string;
|
|
2
18
|
/**
|
|
3
19
|
* Login for a document that cannot complete the flow where it is.
|
|
4
20
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surrogate.d.ts","sourceRoot":"","sources":["../../src/login/surrogate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"surrogate.d.ts","sourceRoot":"","sources":["../../src/login/surrogate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA0B,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAItF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,qBAAqB,UAAW,MAAM,UAAU,MAAM,KAAG,MAUrE,CAAA;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,wBAAwB,QAAO,WA4J3C,CAAA"}
|