@owlmeans/web-client 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 +16 -13
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/web-client/SKILL.md +70 -11
- package/build/components/dispatcher/component.d.ts.map +1 -1
- package/build/components/dispatcher/component.js +54 -9
- package/build/components/dispatcher/component.js.map +1 -1
- package/build/components/dispatcher/parametrise.d.ts.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 +2 -1
- package/build/context.js.map +1 -1
- package/build/entrypoints.d.ts +2 -0
- package/build/entrypoints.d.ts.map +1 -0
- package/build/entrypoints.js +18 -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 +1 -0
- package/build/exports.d.ts.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-pl.json +32 -0
- package/build/i18n/auth-ru.json +32 -0
- package/build/i18n/auth-uk.json +32 -0
- package/build/index.d.ts +2 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -1
- package/build/index.js.map +1 -1
- package/build/login/consts.d.ts +11 -0
- package/build/login/consts.d.ts.map +1 -0
- package/build/login/consts.js +11 -0
- package/build/login/consts.js.map +1 -0
- package/build/login/index.d.ts +8 -0
- package/build/login/index.d.ts.map +1 -0
- package/build/login/index.js +8 -0
- package/build/login/index.js.map +1 -0
- 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 +9 -0
- package/build/login/redirect.d.ts.map +1 -0
- package/build/login/redirect.js +47 -0
- package/build/login/redirect.js.map +1 -0
- package/build/login/screen.d.ts +15 -0
- package/build/login/screen.d.ts.map +1 -0
- package/build/login/screen.js +97 -0
- package/build/login/screen.js.map +1 -0
- package/build/login/service.d.ts +10 -0
- package/build/login/service.d.ts.map +1 -0
- package/build/login/service.js +17 -0
- package/build/login/service.js.map +1 -0
- package/build/login/surrogate.d.ts +21 -0
- package/build/login/surrogate.d.ts.map +1 -0
- package/build/login/surrogate.js +144 -0
- package/build/login/surrogate.js.map +1 -0
- package/build/login/view.d.ts +26 -0
- package/build/login/view.d.ts.map +1 -0
- package/build/login/view.js +73 -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 +9 -1
- package/build/main.js.map +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.d.ts +2 -1
- package/build/types.d.ts.map +1 -1
- package/package.json +17 -17
- package/src/components/dispatcher/component.tsx +72 -8
- package/src/components/dispatcher/types.ts +2 -2
- package/src/context.ts +2 -2
- package/src/entrypoints.ts +20 -0
- package/src/exports.ts +1 -0
- 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-pl.json +32 -0
- package/src/i18n/auth-ru.json +32 -0
- package/src/i18n/auth-uk.json +32 -0
- package/src/index.ts +2 -1
- package/src/login/consts.ts +12 -0
- package/src/login/index.ts +7 -0
- package/src/login/pump.ts +53 -0
- package/src/login/redirect.ts +59 -0
- package/src/login/screen.tsx +119 -0
- package/src/login/service.ts +19 -0
- package/src/login/surrogate.ts +175 -0
- package/src/login/view.tsx +94 -0
- package/src/main.tsx +11 -2
- package/src/middleware.ts +7 -6
- package/src/service.ts +1 -1
- package/src/types.ts +2 -1
- package/build/modules.d.ts +0 -2
- package/build/modules.d.ts.map +0 -1
- package/build/modules.js +0 -8
- package/build/modules.js.map +0 -1
- package/src/modules.ts +0 -9
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import {
|
|
2
|
+
adoptToken, clearSurrogate, markSurrogate, revokeToken, surrogatePath, LoginIntent, LoginOutcome,
|
|
3
|
+
LOGIN_LOGOUT_MESSAGE, LOGIN_SURROGATE_FEATURES, LOGIN_SURROGATE_NAME, LOGIN_TOKEN_MESSAGE,
|
|
4
|
+
} from '@owlmeans/client-auth/login'
|
|
5
|
+
import type { LoginContext, LoginEnv, LoginPlugin } from '@owlmeans/client-auth/login'
|
|
6
|
+
import { SURROGATE_LOGIN, SURROGATE_LOGIN_PRIORITY } from './consts.js'
|
|
7
|
+
import { awaitSurrogate } from './pump.js'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Login for a document that cannot complete the flow where it is.
|
|
11
|
+
*
|
|
12
|
+
* An app embedded in a frame cannot redirect to an identity provider: the provider refuses to be
|
|
13
|
+
* embedded (`frame-ancestors`), and its session cookies are third-party there. So the flow runs
|
|
14
|
+
* one window up, in a surrogate window that is top-level and first-party on this application's own
|
|
15
|
+
* origin — where the very same flow completes normally — and the token is passed back to the
|
|
16
|
+
* document that asked for it.
|
|
17
|
+
*
|
|
18
|
+
* This plugin is deliberately not OIDC-specific. The mechanic is "run the login route one window
|
|
19
|
+
* up and hand the token back", and the adoption is the plain auth service, so any relying party
|
|
20
|
+
* that renders a login route gets it by registering nothing.
|
|
21
|
+
*
|
|
22
|
+
* `match` covers BOTH halves of the lifecycle — the framed opener and the surrogate itself, where
|
|
23
|
+
* `embedded` is false. Inside the surrogate the redirect plugin must not win: that window IS
|
|
24
|
+
* top-level, so it authorizes by an ordinary redirect and differs only in what it does with the
|
|
25
|
+
* token at the end.
|
|
26
|
+
*/
|
|
27
|
+
export const makeSurrogateLoginPlugin = (): LoginPlugin => {
|
|
28
|
+
/**
|
|
29
|
+
* Give the token to whoever is entitled to it, and get out of the way.
|
|
30
|
+
*
|
|
31
|
+
* Shared by `complete` (a token was just issued here) and `resume` (one was already here),
|
|
32
|
+
* because what happens to it is the same in both cases and only the question differs.
|
|
33
|
+
*/
|
|
34
|
+
const handBack = async (token: string, env: LoginEnv): Promise<LoginOutcome> => {
|
|
35
|
+
if (!env.surrogate) {
|
|
36
|
+
// This document started the flow and finished it in place — it already has what it needs.
|
|
37
|
+
return LoginOutcome.Passed
|
|
38
|
+
}
|
|
39
|
+
if (!env.hasOpener) {
|
|
40
|
+
// Authenticated with nowhere to send it. `Cross-Origin-Opener-Policy: same-origin` from the
|
|
41
|
+
// provider severs `window.opener` permanently, so this is not a timing problem to retry.
|
|
42
|
+
return LoginOutcome.Orphaned
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
clearSurrogate()
|
|
46
|
+
// Both windows are the same origin (the surrogate is this application's own login route), so
|
|
47
|
+
// the origin is pinned rather than passed as `*` — the message carries a bearer token.
|
|
48
|
+
window.opener.postMessage({ type: LOGIN_TOKEN_MESSAGE, token }, window.location.origin)
|
|
49
|
+
window.close()
|
|
50
|
+
|
|
51
|
+
return LoginOutcome.Handled
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const plugin: LoginPlugin = {
|
|
55
|
+
alias: SURROGATE_LOGIN,
|
|
56
|
+
priority: SURROGATE_LOGIN_PRIORITY,
|
|
57
|
+
mode: 'surrogate',
|
|
58
|
+
match: env => env.hasWindow && (env.embedded || env.surrogate),
|
|
59
|
+
|
|
60
|
+
enter: () => { markSurrogate() },
|
|
61
|
+
|
|
62
|
+
begin: (ctx, request, env) => {
|
|
63
|
+
// Already one window up — nothing to open, just run the flow.
|
|
64
|
+
if (env.surrogate) {
|
|
65
|
+
window.location.href = request.url
|
|
66
|
+
|
|
67
|
+
return Promise.resolve(LoginOutcome.Redirected)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Opened FIRST and synchronously: `window.open` escapes the popup blocker only while the
|
|
71
|
+
// user gesture is still being handled, so nothing may be awaited before this line. That is
|
|
72
|
+
// why this function is not `async`.
|
|
73
|
+
//
|
|
74
|
+
// The window opens on the surrogate route rather than on the dispatcher, so its very first
|
|
75
|
+
// paint is a bare "signing you in" panel instead of the application with its navigation. The
|
|
76
|
+
// dispatcher address travels as `next`, because the provider's callback still lands there and
|
|
77
|
+
// whatever flow parameters the caller's URL carried must survive the hop.
|
|
78
|
+
const path = surrogatePath(ctx as LoginContext, {
|
|
79
|
+
intent: LoginIntent.Login, next: request.url,
|
|
80
|
+
})
|
|
81
|
+
const surrogate = window.open(
|
|
82
|
+
path ?? request.url, LOGIN_SURROGATE_NAME, LOGIN_SURROGATE_FEATURES
|
|
83
|
+
)
|
|
84
|
+
if (surrogate == null) {
|
|
85
|
+
return Promise.resolve(LoginOutcome.Failed)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return awaitSurrogate(surrogate, LOGIN_TOKEN_MESSAGE, async data => {
|
|
89
|
+
if (data.token == null || data.token === '') {
|
|
90
|
+
return LoginOutcome.Failed
|
|
91
|
+
}
|
|
92
|
+
await adoptToken(ctx as LoginContext, data.token)
|
|
93
|
+
// Adopting the token is not the end of the flow — running the caller's continuation is,
|
|
94
|
+
// exactly as the redirect plugin does before it reports `Handled`. Without it the token
|
|
95
|
+
// lands in the auth service and nothing else happens: the framed app keeps rendering its
|
|
96
|
+
// signed-out tree, and the user watches the login window close over a preview that never
|
|
97
|
+
// changes. `Handled` promises the caller there is nothing left to do.
|
|
98
|
+
await request.navigate?.()
|
|
99
|
+
|
|
100
|
+
return LoginOutcome.Handled
|
|
101
|
+
})
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
authorize: async (_ctx, url, env) => {
|
|
105
|
+
// The surrogate is top-level, so it redirects like any ordinary tab.
|
|
106
|
+
if (env.surrogate) {
|
|
107
|
+
window.location.href = url
|
|
108
|
+
|
|
109
|
+
return LoginOutcome.Redirected
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Framed, and not yet one window up. A redirect from here would land in the frame and be
|
|
113
|
+
// refused, and the window that would fix it cannot be opened without a user gesture — so the
|
|
114
|
+
// caller is told to render a control rather than to navigate.
|
|
115
|
+
return LoginOutcome.Gesture
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
complete: async (_ctx, token, env) => await handBack(token, env),
|
|
119
|
+
|
|
120
|
+
// A session that was already here is worth exactly as much as one just issued — to the window
|
|
121
|
+
// that asked for it. Without this the surrogate would render the signed-in application to
|
|
122
|
+
// itself and the framed app would stay signed out, which is the whole reported defect.
|
|
123
|
+
resume: async (_ctx, token, env) => await handBack(token, env),
|
|
124
|
+
|
|
125
|
+
logout: (ctx, request, env) => {
|
|
126
|
+
// Already one window up — end the session here and tell the opener.
|
|
127
|
+
if (env.surrogate) {
|
|
128
|
+
return revokeToken(ctx as LoginContext)
|
|
129
|
+
.then(async () => await plugin.logoutComplete!(ctx, env))
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const path = surrogatePath(ctx as LoginContext, { intent: LoginIntent.Logout })
|
|
133
|
+
// Opened first and synchronously, for the same reason `begin` does.
|
|
134
|
+
const surrogate = path != null
|
|
135
|
+
? window.open(path, LOGIN_SURROGATE_NAME, LOGIN_SURROGATE_FEATURES)
|
|
136
|
+
: null
|
|
137
|
+
|
|
138
|
+
// The local session goes next, and UNCONDITIONALLY. A blocked window, a severed opener or a
|
|
139
|
+
// user who closes the popup must never leave THIS document signed in: a logout that only
|
|
140
|
+
// half happened is bad, and one that did not happen at all is worse.
|
|
141
|
+
const local = revokeToken(ctx as LoginContext)
|
|
142
|
+
if (surrogate == null) {
|
|
143
|
+
return local.then(async () => {
|
|
144
|
+
await request.navigate?.()
|
|
145
|
+
|
|
146
|
+
return LoginOutcome.Failed
|
|
147
|
+
})
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return local.then(async () => await awaitSurrogate(
|
|
151
|
+
surrogate, LOGIN_LOGOUT_MESSAGE, async () => {
|
|
152
|
+
await request.navigate?.()
|
|
153
|
+
|
|
154
|
+
return LoginOutcome.Handled
|
|
155
|
+
}
|
|
156
|
+
))
|
|
157
|
+
},
|
|
158
|
+
|
|
159
|
+
logoutComplete: async (_ctx, env) => {
|
|
160
|
+
if (!env.surrogate) {
|
|
161
|
+
return LoginOutcome.Passed
|
|
162
|
+
}
|
|
163
|
+
if (!env.hasOpener) {
|
|
164
|
+
return LoginOutcome.Orphaned
|
|
165
|
+
}
|
|
166
|
+
clearSurrogate()
|
|
167
|
+
window.opener.postMessage({ type: LOGIN_LOGOUT_MESSAGE, ok: true }, window.location.origin)
|
|
168
|
+
window.close()
|
|
169
|
+
|
|
170
|
+
return LoginOutcome.Handled
|
|
171
|
+
},
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return plugin
|
|
175
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { CSSProperties, FC } from 'react'
|
|
2
|
+
import { LoginIntent } from '@owlmeans/client-auth/login'
|
|
3
|
+
|
|
4
|
+
/** What the surrogate window is doing, from the point of view of the person watching it. */
|
|
5
|
+
export enum SurrogateStage {
|
|
6
|
+
/** Working. No control — there is nothing for the user to do but wait. */
|
|
7
|
+
Working = 'working',
|
|
8
|
+
/** Needs a click: the flow cannot continue without a fresh gesture. */
|
|
9
|
+
Gesture = 'gesture',
|
|
10
|
+
/** Done here; handing the result back and closing. */
|
|
11
|
+
Handing = 'handing',
|
|
12
|
+
/** Acted, but with no channel back to the window that asked. */
|
|
13
|
+
Orphaned = 'orphaned',
|
|
14
|
+
/** Ended with nothing. */
|
|
15
|
+
Failed = 'failed',
|
|
16
|
+
/** Not a surrogate at all — someone opened this address directly. */
|
|
17
|
+
Standalone = 'standalone',
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface SurrogateViewProps {
|
|
21
|
+
stage: SurrogateStage
|
|
22
|
+
intent: LoginIntent
|
|
23
|
+
onAction?: () => void
|
|
24
|
+
error?: string
|
|
25
|
+
translate?: (key: string, defaultValue: string) => string
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The whole of what a login window shows.
|
|
30
|
+
*
|
|
31
|
+
* Plain elements and inline styles on purpose. This renders in a popup opened by a `web-panel` app,
|
|
32
|
+
* a `mui-panel` app and a generated Tailwind app alike, and none of their stylesheets is loaded
|
|
33
|
+
* here — a class name would simply do nothing. It is also the reason this component carries no
|
|
34
|
+
* dependency on a UI family at all.
|
|
35
|
+
*/
|
|
36
|
+
const box: CSSProperties = {
|
|
37
|
+
maxWidth: '22rem', margin: '15vh auto', padding: '1.5rem', textAlign: 'center',
|
|
38
|
+
fontFamily: 'system-ui, sans-serif', lineHeight: 1.5,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const action: CSSProperties = {
|
|
42
|
+
marginTop: '1rem', padding: '.625rem 1.25rem', fontSize: '1rem',
|
|
43
|
+
cursor: 'pointer', borderRadius: '.375rem', border: '1px solid currentColor',
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const COPY: Record<SurrogateStage, { key: string, en: string, action?: [string, string] }> = {
|
|
47
|
+
[SurrogateStage.Working]: { key: 'working', en: 'Signing you in…' },
|
|
48
|
+
[SurrogateStage.Gesture]: {
|
|
49
|
+
key: 'gesture.title', en: 'Continue to sign in.', action: ['gesture.action', 'Sign in'],
|
|
50
|
+
},
|
|
51
|
+
[SurrogateStage.Handing]: { key: 'handing', en: 'Done. Returning to the application…' },
|
|
52
|
+
[SurrogateStage.Orphaned]: {
|
|
53
|
+
key: 'orphaned', en: 'Signed in. You can close this window and continue in the application.',
|
|
54
|
+
action: ['close', 'Close'],
|
|
55
|
+
},
|
|
56
|
+
[SurrogateStage.Failed]: {
|
|
57
|
+
key: 'failed', en: 'That did not complete. You can close this window and try again.',
|
|
58
|
+
action: ['close', 'Close'],
|
|
59
|
+
},
|
|
60
|
+
[SurrogateStage.Standalone]: {
|
|
61
|
+
key: 'standalone.title', en: 'This page is used to sign in from another window.',
|
|
62
|
+
action: ['standalone.action', 'Open the application'],
|
|
63
|
+
},
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const LOGOUT_COPY: Partial<Record<SurrogateStage, { key: string, en: string }>> = {
|
|
67
|
+
[SurrogateStage.Working]: { key: 'working', en: 'Signing you out…' },
|
|
68
|
+
[SurrogateStage.Gesture]: { key: 'gesture.title', en: 'Continue to sign out.' },
|
|
69
|
+
[SurrogateStage.Handing]: { key: 'handing', en: 'Signed out. Returning to the application…' },
|
|
70
|
+
[SurrogateStage.Orphaned]: {
|
|
71
|
+
key: 'orphaned', en: 'Signed out. You can close this window.',
|
|
72
|
+
},
|
|
73
|
+
[SurrogateStage.Failed]: {
|
|
74
|
+
key: 'failed', en: 'Sign-out did not complete here. You can close this window.',
|
|
75
|
+
},
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const LoginSurrogateView: FC<SurrogateViewProps> = (
|
|
79
|
+
{ stage, intent, onAction, error, translate }
|
|
80
|
+
) => {
|
|
81
|
+
const t = translate ?? ((_key: string, defaultValue: string) => defaultValue)
|
|
82
|
+
const scope = intent === LoginIntent.Logout ? 'logout' : 'login'
|
|
83
|
+
const base = COPY[stage]
|
|
84
|
+
const copy = (intent === LoginIntent.Logout ? LOGOUT_COPY[stage] : undefined) ?? base
|
|
85
|
+
|
|
86
|
+
return <div style={box} data-surrogate-stage={stage} data-surrogate-intent={intent}>
|
|
87
|
+
<p>{t(`surrogate.${scope}.${copy.key}`, copy.en)}</p>
|
|
88
|
+
{error != null && error !== '' &&
|
|
89
|
+
<p style={{ color: '#b00', fontSize: '.875rem' }} role="alert">{error}</p>}
|
|
90
|
+
{base.action != null && onAction != null && <button type="button" style={action} onClick={onAction}>
|
|
91
|
+
{t(`surrogate.${scope}.${base.action[0]}`, base.action[1])}
|
|
92
|
+
</button>}
|
|
93
|
+
</div>
|
|
94
|
+
}
|
package/src/main.tsx
CHANGED
|
@@ -25,5 +25,14 @@ export const render = (node: ReactNode, opts?: RenderOptions) => {
|
|
|
25
25
|
opts?.onReady ?? true ? window.addEventListener('DOMContentLoaded', _callback) : _callback()
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Mount the application.
|
|
30
|
+
*
|
|
31
|
+
* `children` are rendered inside the context provider and BEFORE the router, which makes them the
|
|
32
|
+
* app's global overlay slot: a consent dialog, a toast surface, anything that must exist on every
|
|
33
|
+
* route and outlive navigation. A component mounted inside a route instead is torn down and
|
|
34
|
+
* rebuilt on every navigation, which for a dialog means it closes itself.
|
|
35
|
+
*/
|
|
36
|
+
export const renderApp = <C extends AppConfig, T extends AppContext<C>>(
|
|
37
|
+
context: T, opts?: RenderOptions, children?: ReactNode
|
|
38
|
+
) => render(<WebApp context={context}>{children}</WebApp>, opts)
|
package/src/middleware.ts
CHANGED
|
@@ -11,18 +11,19 @@ export const logoutMiddleware: Middleware = {
|
|
|
11
11
|
stage: MiddlewareStage.Loading,
|
|
12
12
|
apply: async context => {
|
|
13
13
|
context.entrypoints<Perked>().forEach(module => {
|
|
14
|
-
if (module.route.route.type === AppType.Backend && module.
|
|
14
|
+
if (module.route.route.type === AppType.Backend && module.invoke != null) {
|
|
15
15
|
const guards = module.getGuards()
|
|
16
16
|
if (guards.length > 0) {
|
|
17
17
|
if (module._auth_web_middleware_applied === true) {
|
|
18
18
|
return
|
|
19
19
|
}
|
|
20
20
|
module._auth_web_middleware_applied = true
|
|
21
|
-
//
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
// Wrapping `invoke` covers `call` too: `call` reads `invoke` off the entrypoint at the
|
|
22
|
+
// moment it runs, so a rejected session is caught whichever verb the caller used.
|
|
23
|
+
const invoke = module.invoke
|
|
24
|
+
module.invoke = (async req => {
|
|
24
25
|
try {
|
|
25
|
-
return await
|
|
26
|
+
return await invoke(req)
|
|
26
27
|
} catch (e) {
|
|
27
28
|
if (e instanceof Error) {
|
|
28
29
|
const err = ResilientError.ensure(e)
|
|
@@ -38,7 +39,7 @@ export const logoutMiddleware: Middleware = {
|
|
|
38
39
|
}
|
|
39
40
|
throw e
|
|
40
41
|
}
|
|
41
|
-
}
|
|
42
|
+
}) as typeof module.invoke
|
|
42
43
|
|
|
43
44
|
}
|
|
44
45
|
}
|
package/src/service.ts
CHANGED
|
@@ -16,7 +16,7 @@ export const makeAuthWebService = (alias: string = DEFAULT_ALIAS): AuthService =
|
|
|
16
16
|
await update(token)
|
|
17
17
|
if (token == null) {
|
|
18
18
|
const module = service.assertCtx().entrypoint<ClientEntrypoint<string>>(DISPATCHER)
|
|
19
|
-
const
|
|
19
|
+
const url = await module.url()
|
|
20
20
|
document.location.href = url
|
|
21
21
|
}
|
|
22
22
|
}
|
package/src/types.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AuthServiceAppend } from '@owlmeans/client-auth'
|
|
2
|
+
import type { LoginServiceAppend } from '@owlmeans/client-auth/login'
|
|
2
3
|
import type { ClientConfig } from '@owlmeans/client-context'
|
|
3
4
|
import type { ClientContext } from '@owlmeans/client'
|
|
4
5
|
|
|
@@ -13,5 +14,5 @@ export interface AppConfig extends ClientConfig {
|
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export interface AppContext<C extends AppConfig = AppConfig> extends ClientContext<C>,
|
|
16
|
-
AuthServiceAppend {
|
|
17
|
+
AuthServiceAppend, LoginServiceAppend {
|
|
17
18
|
}
|
package/build/modules.d.ts
DELETED
package/build/modules.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../src/modules.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,OAAO,uHAAO,CAAA"}
|
package/build/modules.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { DISPATCHER } from '@owlmeans/auth';
|
|
2
|
-
import { modules as list } from '@owlmeans/client-auth';
|
|
3
|
-
import { elevate } from '@owlmeans/client-entrypoint';
|
|
4
|
-
import { handler } from '@owlmeans/client';
|
|
5
|
-
import { Dispatcher } from './components/dispatcher/component.js';
|
|
6
|
-
elevate(list, DISPATCHER, handler(Dispatcher), { force: true });
|
|
7
|
-
export const modules = list;
|
|
8
|
-
//# sourceMappingURL=modules.js.map
|
package/build/modules.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"modules.js","sourceRoot":"","sources":["../src/modules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAA;AAEjE,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;AAE/D,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAA"}
|
package/src/modules.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { DISPATCHER } from '@owlmeans/auth'
|
|
2
|
-
import { modules as list } from '@owlmeans/client-auth'
|
|
3
|
-
import { elevate } from '@owlmeans/client-entrypoint'
|
|
4
|
-
import { handler } from '@owlmeans/client'
|
|
5
|
-
import { Dispatcher } from './components/dispatcher/component.js'
|
|
6
|
-
|
|
7
|
-
elevate(list, DISPATCHER, handler(Dispatcher), { force: true })
|
|
8
|
-
|
|
9
|
-
export const modules = list
|