@owlmeans/client-auth 0.1.18-rc.4 → 0.1.18-rc.41
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 +280 -37
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/client-auth/SKILL.md +139 -21
- package/build/components/dispatcher/component.d.ts.map +1 -1
- package/build/components/dispatcher/component.js +14 -3
- package/build/components/dispatcher/component.js.map +1 -1
- 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 +24 -3
- package/build/helper.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/login/adopt.d.ts +24 -0
- package/build/login/adopt.d.ts.map +1 -0
- package/build/login/adopt.js +28 -0
- package/build/login/adopt.js.map +1 -0
- package/build/login/consts.d.ts +49 -0
- package/build/login/consts.d.ts.map +1 -0
- package/build/login/consts.js +49 -0
- package/build/login/consts.js.map +1 -0
- package/build/login/credit.d.ts +24 -0
- package/build/login/credit.d.ts.map +1 -0
- package/build/login/credit.js +58 -0
- package/build/login/credit.js.map +1 -0
- package/build/login/env.d.ts +32 -0
- package/build/login/env.d.ts.map +1 -0
- package/build/login/env.js +84 -0
- package/build/login/env.js.map +1 -0
- package/build/login/flow.d.ts +20 -0
- package/build/login/flow.d.ts.map +1 -0
- package/build/login/flow.js +39 -0
- package/build/login/flow.js.map +1 -0
- package/build/login/hook.d.ts +37 -0
- package/build/login/hook.d.ts.map +1 -0
- package/build/login/hook.js +72 -0
- package/build/login/hook.js.map +1 -0
- package/build/login/i18n/be.json +37 -0
- package/build/login/i18n/de.json +37 -0
- package/build/login/i18n/en.json +37 -0
- package/build/login/i18n/es.json +37 -0
- package/build/login/i18n/fr.json +37 -0
- package/build/login/i18n/pl.json +37 -0
- package/build/login/i18n/ru.json +37 -0
- package/build/login/i18n/uk.json +37 -0
- package/build/login/i18n.d.ts +2 -0
- package/build/login/i18n.d.ts.map +1 -0
- package/build/login/i18n.js +27 -0
- package/build/login/i18n.js.map +1 -0
- package/build/login/index.d.ts +15 -0
- package/build/login/index.d.ts.map +1 -0
- package/build/login/index.js +15 -0
- package/build/login/index.js.map +1 -0
- package/build/login/methods.d.ts +25 -0
- package/build/login/methods.d.ts.map +1 -0
- package/build/login/methods.js +97 -0
- package/build/login/methods.js.map +1 -0
- package/build/login/resume.d.ts +30 -0
- package/build/login/resume.d.ts.map +1 -0
- package/build/login/resume.js +57 -0
- package/build/login/resume.js.map +1 -0
- package/build/login/screen.d.ts +17 -0
- package/build/login/screen.d.ts.map +1 -0
- package/build/login/screen.js +76 -0
- package/build/login/screen.js.map +1 -0
- package/build/login/service.d.ts +31 -0
- package/build/login/service.d.ts.map +1 -0
- package/build/login/service.js +148 -0
- package/build/login/service.js.map +1 -0
- package/build/login/surrogate.d.ts +20 -0
- package/build/login/surrogate.d.ts.map +1 -0
- package/build/login/surrogate.js +33 -0
- package/build/login/surrogate.js.map +1 -0
- package/build/login/terms.d.ts +20 -0
- package/build/login/terms.d.ts.map +1 -0
- package/build/login/terms.js +0 -0
- package/build/login/terms.js.map +1 -0
- package/build/login/types.d.ts +256 -0
- package/build/login/types.d.ts.map +1 -0
- package/build/login/types.js +31 -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 +2 -0
- package/build/manager/plugins/exports.d.ts.map +1 -1
- package/build/manager/plugins/exports.js +2 -0
- package/build/manager/plugins/exports.js.map +1 -1
- package/build/manager/plugins/index.d.ts +1 -5
- package/build/manager/plugins/index.d.ts.map +1 -1
- package/build/manager/plugins/index.js +9 -1
- package/build/manager/plugins/index.js.map +1 -1
- package/build/manager/plugins/methods.d.ts +6 -0
- package/build/manager/plugins/methods.d.ts.map +1 -0
- package/build/manager/plugins/methods.js +65 -0
- package/build/manager/plugins/methods.js.map +1 -0
- package/build/manager/plugins/re-captcha.d.ts.map +1 -1
- package/build/manager/plugins/re-captcha.js +5 -0
- package/build/manager/plugins/re-captcha.js.map +1 -1
- package/build/manager/plugins/registry.d.ts +20 -0
- package/build/manager/plugins/registry.d.ts.map +1 -0
- package/build/manager/plugins/registry.js +19 -0
- package/build/manager/plugins/registry.js.map +1 -0
- package/build/manager/plugins/tunnel-consumer.d.ts.map +1 -1
- package/build/manager/plugins/tunnel-consumer.js +8 -1
- package/build/manager/plugins/tunnel-consumer.js.map +1 -1
- package/build/manager/plugins/types.d.ts +53 -0
- package/build/manager/plugins/types.d.ts.map +1 -1
- package/build/service.js +1 -1
- package/build/service.js.map +1 -1
- package/package.json +36 -27
- package/src/components/dispatcher/component.tsx +16 -3
- package/src/entrypoints.ts +10 -0
- package/src/helper.ts +26 -3
- package/src/index.ts +1 -1
- package/src/login/adopt.ts +31 -0
- package/src/login/consts.ts +64 -0
- package/src/login/credit.ts +75 -0
- package/src/login/env.ts +86 -0
- package/src/login/flow.ts +44 -0
- package/src/login/hook.ts +80 -0
- package/src/login/i18n/be.json +37 -0
- package/src/login/i18n/de.json +37 -0
- package/src/login/i18n/en.json +37 -0
- package/src/login/i18n/es.json +37 -0
- package/src/login/i18n/fr.json +37 -0
- package/src/login/i18n/pl.json +37 -0
- package/src/login/i18n/ru.json +37 -0
- package/src/login/i18n/uk.json +37 -0
- package/src/login/i18n.ts +28 -0
- package/src/login/index.ts +15 -0
- package/src/login/methods.ts +113 -0
- package/src/login/resume.ts +58 -0
- package/src/login/screen.tsx +136 -0
- package/src/login/service.ts +195 -0
- package/src/login/surrogate.ts +45 -0
- package/src/login/terms.ts +0 -0
- package/src/login/types.ts +279 -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 +2 -0
- package/src/manager/plugins/index.ts +10 -4
- package/src/manager/plugins/methods.ts +74 -0
- package/src/manager/plugins/re-captcha.tsx +7 -0
- package/src/manager/plugins/registry.ts +26 -0
- package/src/manager/plugins/tunnel-consumer.tsx +10 -1
- package/src/manager/plugins/types.ts +54 -0
- package/src/service.ts +1 -1
- package/tests/context.ts +1 -2
- package/tests/login.spec.ts +332 -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,256 @@
|
|
|
1
|
+
import type { ComponentType, CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import type { LazyService, BasicContext } from '@owlmeans/context';
|
|
3
|
+
import type { LoginMethodEmphasis, LoginScreenConfig, LoginTermsConfig } from '@owlmeans/config';
|
|
4
|
+
/**
|
|
5
|
+
* The context a login plugin is handed.
|
|
6
|
+
*
|
|
7
|
+
* Deliberately `BasicContext<any>`, matching `RouterService`: a plugin only ever reaches services
|
|
8
|
+
* by alias, and pinning the config parameter would make every concrete app config — each of which
|
|
9
|
+
* adds its own required fields — fail to satisfy it, since `makeContext` is invariant in it.
|
|
10
|
+
*/
|
|
11
|
+
export type LoginContext = BasicContext<any>;
|
|
12
|
+
/**
|
|
13
|
+
* Environment descriptor the cascade selects a login plugin on.
|
|
14
|
+
*
|
|
15
|
+
* This is the single source of environment truth — do NOT bake `window.self !== window.top` or a
|
|
16
|
+
* `sessionStorage` probe into a plugin's `match`. A native host will supply its own descriptor
|
|
17
|
+
* (`hasWindow: false`) so an in-app-browser plugin wins there without any DOM check.
|
|
18
|
+
*/
|
|
19
|
+
export interface LoginEnv {
|
|
20
|
+
/** A DOM is present at all (false under SSR, native, and unit tests). */
|
|
21
|
+
hasWindow: boolean;
|
|
22
|
+
/** This document is embedded in a frame. A cross-origin `top` read throws — that throw counts. */
|
|
23
|
+
embedded: boolean;
|
|
24
|
+
/** This document IS the surrogate login window; survives the cross-origin round trip. */
|
|
25
|
+
surrogate: boolean;
|
|
26
|
+
/** The window that opened this one is still reachable (COOP severs it permanently). */
|
|
27
|
+
hasOpener: boolean;
|
|
28
|
+
}
|
|
29
|
+
/** What a stage did, and therefore what the caller must do next. */
|
|
30
|
+
export declare enum LoginOutcome {
|
|
31
|
+
/** The plugin took the flow over and it is finished. The caller does nothing more. */
|
|
32
|
+
Handled = "handled",
|
|
33
|
+
/** The plugin did nothing — the caller carries on with its ordinary continuation. */
|
|
34
|
+
Passed = "passed",
|
|
35
|
+
/** The browser is leaving this document. The caller must not navigate or render. */
|
|
36
|
+
Redirected = "redirected",
|
|
37
|
+
/** Cannot proceed without a fresh user gesture — the caller renders a sign-in control. */
|
|
38
|
+
Gesture = "gesture",
|
|
39
|
+
/** Authenticated, but with no channel back to the window that started it. */
|
|
40
|
+
Orphaned = "orphaned",
|
|
41
|
+
/** The attempt ended with no token (the user closed the window, or the provider refused it). */
|
|
42
|
+
Failed = "failed",
|
|
43
|
+
/**
|
|
44
|
+
* A window this flow needed could not be opened at all — `window.open` returned `null`, which is
|
|
45
|
+
* the browser's own popup blocker, not a flow failure. Distinct from {@link Failed}: a caller
|
|
46
|
+
* with nowhere inline to render (a header "Log in"/"Log out" control, not the sign-in screen)
|
|
47
|
+
* needs to know specifically that a fresh click reopening the SAME control will not help, and
|
|
48
|
+
* that the browser is already showing its own blocked-popup affordance somewhere.
|
|
49
|
+
*/
|
|
50
|
+
Blocked = "blocked"
|
|
51
|
+
}
|
|
52
|
+
/** Why a surrogate window was opened. */
|
|
53
|
+
export declare enum LoginIntent {
|
|
54
|
+
Login = "login",
|
|
55
|
+
Logout = "logout"
|
|
56
|
+
}
|
|
57
|
+
export interface LoginRequest {
|
|
58
|
+
/** Where the login flow starts — a resolved dispatcher path, or the current address. */
|
|
59
|
+
url: string;
|
|
60
|
+
/**
|
|
61
|
+
* The ordinary in-app continuation, supplied by the caller because only a component may call
|
|
62
|
+
* `useNavigate`. A plugin that decides not to take the flow over calls this; without it the
|
|
63
|
+
* fallback is a full page load of {@link url}.
|
|
64
|
+
*/
|
|
65
|
+
navigate?: () => void | Promise<void>;
|
|
66
|
+
/** Entrypoint alias to return to after login. */
|
|
67
|
+
target?: string;
|
|
68
|
+
}
|
|
69
|
+
export interface LogoutRequest {
|
|
70
|
+
/** Where a surrogate logout runs — a resolved surrogate path. */
|
|
71
|
+
url: string;
|
|
72
|
+
/** The in-app continuation once the local session is gone. */
|
|
73
|
+
navigate?: () => void | Promise<void>;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* A pluggable login mechanic — WHERE the authorization round trip runs.
|
|
77
|
+
*
|
|
78
|
+
* Not to be confused with `AuthenticationPlugin` (./manager/plugins), which answers *how* a user
|
|
79
|
+
* proves their identity. This one answers *in which browsing context the flow can complete*: a
|
|
80
|
+
* redirect works in an ordinary tab and cannot work inside a frame whose provider refuses to be
|
|
81
|
+
* embedded, and that difference is a property of the environment, not of the credential.
|
|
82
|
+
*/
|
|
83
|
+
export interface LoginPlugin {
|
|
84
|
+
alias: string;
|
|
85
|
+
/** Higher wins among matching plugins. Defaults to 0. */
|
|
86
|
+
priority?: number;
|
|
87
|
+
/** Free-form tag, e.g. 'redirect' | 'surrogate' | 'native'. */
|
|
88
|
+
mode?: string;
|
|
89
|
+
/** Selector; `undefined` means "always applicable". */
|
|
90
|
+
match?: (env: LoginEnv, ctx?: LoginContext) => boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Record, while it is still knowable, whatever the later stages need about this document.
|
|
93
|
+
*
|
|
94
|
+
* Called synchronously as the FIRST statement of the dispatcher's effect: everything after it
|
|
95
|
+
* can navigate away, and some of the evidence (notably `window.name`) is cleared by the browser
|
|
96
|
+
* the moment a top-level context goes cross-origin.
|
|
97
|
+
*/
|
|
98
|
+
enter?: (ctx: LoginContext, env: LoginEnv) => void;
|
|
99
|
+
/**
|
|
100
|
+
* Start login from a user gesture.
|
|
101
|
+
*
|
|
102
|
+
* MUST open any window synchronously — the popup blocker only yields while the gesture is still
|
|
103
|
+
* being handled. Implement as a NON-async function returning a promise.
|
|
104
|
+
*/
|
|
105
|
+
begin: (ctx: LoginContext, request: LoginRequest, env: LoginEnv) => Promise<LoginOutcome>;
|
|
106
|
+
/** Send the browser to the identity provider's authorization URL. */
|
|
107
|
+
authorize: (ctx: LoginContext, url: string, env: LoginEnv) => Promise<LoginOutcome>;
|
|
108
|
+
/** A bearer token was issued in this document — decide where it goes. */
|
|
109
|
+
complete: (ctx: LoginContext, token: string, env: LoginEnv) => Promise<LoginOutcome>;
|
|
110
|
+
/**
|
|
111
|
+
* This document ALREADY holds a session — decide whether it is useful here.
|
|
112
|
+
*
|
|
113
|
+
* Absent means `Passed`: keep it and carry on, which is what an ordinary tab has always done.
|
|
114
|
+
* A surrogate hands it back to its opener instead, which is the whole point: a popup that
|
|
115
|
+
* discovers an existing session must sign the framed application in, not display the
|
|
116
|
+
* application to itself.
|
|
117
|
+
*
|
|
118
|
+
* Deliberately not `complete`: "a token was just issued here" and "a token was already here"
|
|
119
|
+
* are different facts, and a silent-refresh plugin will need to tell them apart.
|
|
120
|
+
*/
|
|
121
|
+
resume?: (ctx: LoginContext, token: string, env: LoginEnv) => Promise<LoginOutcome>;
|
|
122
|
+
/**
|
|
123
|
+
* Start logout from a user gesture.
|
|
124
|
+
*
|
|
125
|
+
* MUST open any window synchronously, for exactly the reason `begin` must — logging out of a
|
|
126
|
+
* framed application opens a window too. Implement as a NON-async function.
|
|
127
|
+
*/
|
|
128
|
+
logout?: (ctx: LoginContext, request: LogoutRequest, env: LoginEnv) => Promise<LoginOutcome>;
|
|
129
|
+
/** The local session is gone in this document — decide what to tell whom. */
|
|
130
|
+
logoutComplete?: (ctx: LoginContext, env: LoginEnv) => Promise<LoginOutcome>;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Something that must be true before a login flow may start.
|
|
134
|
+
*
|
|
135
|
+
* SYNCHRONOUS on purpose. `begin` must not cross a microtask boundary before a plugin's
|
|
136
|
+
* `window.open`, or the popup blocker eats the window. A precondition that has to ask a server
|
|
137
|
+
* belongs somewhere else entirely.
|
|
138
|
+
*
|
|
139
|
+
* Returning false stops the flow and resolves `begin` as {@link LoginOutcome.Gesture} — which
|
|
140
|
+
* already means "cannot proceed without a fresh user gesture; render a control", and is exactly
|
|
141
|
+
* the state a user is in after a blocking dialog has opened over the page.
|
|
142
|
+
*/
|
|
143
|
+
export interface LoginPrecondition {
|
|
144
|
+
alias: string;
|
|
145
|
+
/** Higher runs first. Defaults to 0. */
|
|
146
|
+
priority?: number;
|
|
147
|
+
check: (ctx: LoginContext, request: LoginRequest, env: LoginEnv) => boolean;
|
|
148
|
+
}
|
|
149
|
+
/** What a source needs in order to describe the methods it offers. */
|
|
150
|
+
export interface LoginMethodContext {
|
|
151
|
+
context: LoginContext;
|
|
152
|
+
env: LoginEnv;
|
|
153
|
+
/** In-app navigation, when a component supplied it. */
|
|
154
|
+
navigate?: (alias: string, params?: Record<string, string>) => void | Promise<void>;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* One way to sign in, as the screen renders it.
|
|
158
|
+
*
|
|
159
|
+
* `start` is what a button calls. It MUST be callable synchronously from a click — branch on
|
|
160
|
+
* `env.embedded && !env.surrogate` first and open any window before the first `await`.
|
|
161
|
+
*/
|
|
162
|
+
export interface LoginMethod {
|
|
163
|
+
id: string;
|
|
164
|
+
/** Set when an `AuthenticationPlugin` drives this method. */
|
|
165
|
+
type?: string;
|
|
166
|
+
label?: string;
|
|
167
|
+
i18nKey?: string;
|
|
168
|
+
icon?: string;
|
|
169
|
+
order?: number;
|
|
170
|
+
emphasis?: LoginMethodEmphasis;
|
|
171
|
+
restricted?: boolean;
|
|
172
|
+
params?: Record<string, string>;
|
|
173
|
+
start: (ctx: LoginMethodContext) => Promise<LoginOutcome>;
|
|
174
|
+
}
|
|
175
|
+
export interface LoginMethodSource {
|
|
176
|
+
alias: string;
|
|
177
|
+
list: (ctx: LoginMethodContext) => LoginMethod[];
|
|
178
|
+
}
|
|
179
|
+
/** What every rendering of the sign-in screen accepts, whatever its UI family. */
|
|
180
|
+
export interface LoginScreenProps {
|
|
181
|
+
/** The one thing a consuming application is expected to supply. */
|
|
182
|
+
Logo?: ComponentType<{
|
|
183
|
+
className?: string;
|
|
184
|
+
}> | ReactNode;
|
|
185
|
+
title?: ReactNode;
|
|
186
|
+
subtitle?: ReactNode;
|
|
187
|
+
/**
|
|
188
|
+
* `(key, defaultValue) => string`. A prop, never an implicit context read: a component that
|
|
189
|
+
* reaches for an i18n provider crashes the whole render in an app mounted without one.
|
|
190
|
+
*/
|
|
191
|
+
translate?: (key: string, defaultValue: string) => string;
|
|
192
|
+
/** Replace or reorder what the resolver produced. */
|
|
193
|
+
methods?: LoginMethod[] | ((methods: LoginMethod[]) => LoginMethod[]);
|
|
194
|
+
terms?: LoginTermsConfig | false;
|
|
195
|
+
config?: LoginScreenConfig;
|
|
196
|
+
/** Replaces the composed credit line entirely. */
|
|
197
|
+
footer?: ReactNode;
|
|
198
|
+
className?: string;
|
|
199
|
+
containerClassName?: string;
|
|
200
|
+
/**
|
|
201
|
+
* Inline overrides for the screen's outer box.
|
|
202
|
+
*
|
|
203
|
+
* It exists because the outer box carries its viewport height inline rather than as a utility
|
|
204
|
+
* class, and an escape hatch that a class can no longer provide has to be provided some other
|
|
205
|
+
* way. See the note on the screen itself.
|
|
206
|
+
*/
|
|
207
|
+
style?: CSSProperties;
|
|
208
|
+
}
|
|
209
|
+
export type LoginScreenComponent = ComponentType<LoginScreenProps>;
|
|
210
|
+
/**
|
|
211
|
+
* A way to surface a `begin`/`logout` outcome that has no inline screen to render it on.
|
|
212
|
+
*
|
|
213
|
+
* A header "Log in"/"Log out" control (`useLogin`/`useLogout`) fires the facade and forgets the
|
|
214
|
+
* result — it renders nothing of its own, unlike the sign-in screen, which already shows
|
|
215
|
+
* `loginAttemptError` inline. Registering one is how a UI package (`web-panel`, `mui-panel`) gives
|
|
216
|
+
* that control a way to speak — e.g. a toast when {@link LoginOutcome.Blocked} fires. Unregistered,
|
|
217
|
+
* it is silence, which is what a non-DOM host and a screen-mounted flow both already have.
|
|
218
|
+
*/
|
|
219
|
+
export type LoginNotifier = (outcome: LoginOutcome, env: LoginEnv) => void;
|
|
220
|
+
export interface LoginService extends LazyService {
|
|
221
|
+
registerPlugin: (plugin: LoginPlugin) => void;
|
|
222
|
+
/** Select the active plugin for the given (or default) environment. */
|
|
223
|
+
plugin: (env?: LoginEnv) => LoginPlugin;
|
|
224
|
+
/** The environment the cascade is currently selecting on. */
|
|
225
|
+
env: () => LoginEnv;
|
|
226
|
+
/** Something that must hold before any flow starts. Checked synchronously, in `begin`. */
|
|
227
|
+
registerPrecondition: (precondition: LoginPrecondition) => void;
|
|
228
|
+
/** A source of offerable sign-in methods, scoped to this context. */
|
|
229
|
+
registerMethodSource: (source: LoginMethodSource) => void;
|
|
230
|
+
methods: (ctx: LoginMethodContext) => LoginMethod[];
|
|
231
|
+
/**
|
|
232
|
+
* The screen a dispatcher renders when it cannot proceed.
|
|
233
|
+
*
|
|
234
|
+
* A slot rather than an import, because a relying party (`web-oidc-rp`) must never depend on a
|
|
235
|
+
* UI family (`web-panel` / `mui-panel`) — that edge would force every relying party to pick one.
|
|
236
|
+
*/
|
|
237
|
+
registerScreen: (screen: LoginScreenComponent) => void;
|
|
238
|
+
screen: () => LoginScreenComponent | null;
|
|
239
|
+
/** See {@link LoginNotifier}. Replaces any previously registered notifier. */
|
|
240
|
+
registerNotifier: (notifier: LoginNotifier) => void;
|
|
241
|
+
enter: () => void;
|
|
242
|
+
begin: (request: LoginRequest) => Promise<LoginOutcome>;
|
|
243
|
+
authorize: (url: string) => Promise<LoginOutcome>;
|
|
244
|
+
complete: (token: string) => Promise<LoginOutcome>;
|
|
245
|
+
resume: (token: string) => Promise<LoginOutcome>;
|
|
246
|
+
logout: (request: LogoutRequest) => Promise<LoginOutcome>;
|
|
247
|
+
logoutComplete: () => Promise<LoginOutcome>;
|
|
248
|
+
/** Adopt an issued bearer token as this context's authentication. */
|
|
249
|
+
adopt: (token: string) => Promise<void>;
|
|
250
|
+
/** Drop this document's authentication. The single de-adoption path. */
|
|
251
|
+
revoke: () => Promise<void>;
|
|
252
|
+
}
|
|
253
|
+
export interface LoginServiceAppend {
|
|
254
|
+
login: () => LoginService;
|
|
255
|
+
}
|
|
256
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/login/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAEhG;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG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AE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAA;IAInD,KAAK,EAAE,MAAM,IAAI,CAAA;IACjB,KAAK,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,YAAY,CAAC,CAAA;IACvD,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,CAAA;IACjD,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,CAAA;IAClD,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,CAAA;IAChD,MAAM,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC,YAAY,CAAC,CAAA;IACzD,cAAc,EAAE,MAAM,OAAO,CAAC,YAAY,CAAC,CAAA;IAC3C,qEAAqE;IACrE,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACvC,wEAAwE;IACxE,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC5B;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,YAAY,CAAA;CAC1B"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** What a stage did, and therefore what the caller must do next. */
|
|
2
|
+
export var LoginOutcome;
|
|
3
|
+
(function (LoginOutcome) {
|
|
4
|
+
/** The plugin took the flow over and it is finished. The caller does nothing more. */
|
|
5
|
+
LoginOutcome["Handled"] = "handled";
|
|
6
|
+
/** The plugin did nothing — the caller carries on with its ordinary continuation. */
|
|
7
|
+
LoginOutcome["Passed"] = "passed";
|
|
8
|
+
/** The browser is leaving this document. The caller must not navigate or render. */
|
|
9
|
+
LoginOutcome["Redirected"] = "redirected";
|
|
10
|
+
/** Cannot proceed without a fresh user gesture — the caller renders a sign-in control. */
|
|
11
|
+
LoginOutcome["Gesture"] = "gesture";
|
|
12
|
+
/** Authenticated, but with no channel back to the window that started it. */
|
|
13
|
+
LoginOutcome["Orphaned"] = "orphaned";
|
|
14
|
+
/** The attempt ended with no token (the user closed the window, or the provider refused it). */
|
|
15
|
+
LoginOutcome["Failed"] = "failed";
|
|
16
|
+
/**
|
|
17
|
+
* A window this flow needed could not be opened at all — `window.open` returned `null`, which is
|
|
18
|
+
* the browser's own popup blocker, not a flow failure. Distinct from {@link Failed}: a caller
|
|
19
|
+
* with nowhere inline to render (a header "Log in"/"Log out" control, not the sign-in screen)
|
|
20
|
+
* needs to know specifically that a fresh click reopening the SAME control will not help, and
|
|
21
|
+
* that the browser is already showing its own blocked-popup affordance somewhere.
|
|
22
|
+
*/
|
|
23
|
+
LoginOutcome["Blocked"] = "blocked";
|
|
24
|
+
})(LoginOutcome || (LoginOutcome = {}));
|
|
25
|
+
/** Why a surrogate window was opened. */
|
|
26
|
+
export var LoginIntent;
|
|
27
|
+
(function (LoginIntent) {
|
|
28
|
+
LoginIntent["Login"] = "login";
|
|
29
|
+
LoginIntent["Logout"] = "logout";
|
|
30
|
+
})(LoginIntent || (LoginIntent = {}));
|
|
31
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/login/types.ts"],"names":[],"mappings":"AA+BA,oEAAoE;AACpE,MAAM,CAAN,IAAY,YAqBX;AArBD,WAAY,YAAY;IACtB,sFAAsF;IACtF,mCAAmB,CAAA;IACnB,qFAAqF;IACrF,iCAAiB,CAAA;IACjB,oFAAoF;IACpF,yCAAyB,CAAA;IACzB,0FAA0F;IAC1F,mCAAmB,CAAA;IACnB,6EAA6E;IAC7E,qCAAqB,CAAA;IACrB,gGAAgG;IAChG,iCAAiB,CAAA;IACjB;;;;;;OAMG;IACH,mCAAmB,CAAA;AACrB,CAAC,EArBW,YAAY,KAAZ,YAAY,QAqBvB;AAED,yCAAyC;AACzC,MAAM,CAAN,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,8BAAe,CAAA;IACf,gCAAiB,CAAA;AACnB,CAAC,EAHW,WAAW,KAAX,WAAW,QAGtB"}
|
|
@@ -23,7 +23,7 @@ export const makeControl = (context, callback) => {
|
|
|
23
23
|
control.beforeAuthenticate = plugins[control.type].beforeAuthenticate;
|
|
24
24
|
control.afterAuthenticate = plugins[control.type].afterAuthenticate;
|
|
25
25
|
const module = context.entrypoint(AUTHEN_INIT);
|
|
26
|
-
const
|
|
26
|
+
const allowance = await module.call({ body: control.request });
|
|
27
27
|
control.allowance = allowance;
|
|
28
28
|
control.updateStage(AuthenticationStage.Authenticate);
|
|
29
29
|
},
|
|
@@ -56,8 +56,8 @@ export const makeControl = (context, callback) => {
|
|
|
56
56
|
}
|
|
57
57
|
// We return back unwrapped challenge
|
|
58
58
|
credentials.challenge = control.allowance?.challenge;
|
|
59
|
-
const
|
|
60
|
-
.
|
|
59
|
+
const { value: token, outcome: status } = await context.entrypoint(AUTHEN_AUTHEN)
|
|
60
|
+
.invoke({ body: credentials });
|
|
61
61
|
if (status === EntrypointOutcome.Ok && token.token != null
|
|
62
62
|
&& token.token !== '' && control.afterAuthenticate != null) {
|
|
63
63
|
const resultingCred = makeEnvelopeModel(token.token, EnvelopeKind.Token).message();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.js","sourceRoot":"","sources":["../../../../src/manager/components/authentication/control.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,mBAAmB,EAAE,kBAAkB,GAC1F,MAAM,gBAAgB,CAAA;AAKvB,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAE1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,aAAa,IAAI,YAAY,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAEjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAEhD,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,OAAoC,EACpC,QAAiD,EAC1B,EAAE;IACzB,sDAAsD;IACtD,MAAM,OAAO,GAA0B;QAErC,KAAK,EAAE,mBAAmB,CAAC,IAAI;QAE/B,IAAI,EAAE,kBAAkB,CAAC,YAAY;QAErC,QAAQ;QAER,QAAQ,EAAE,KAAK,EAAC,KAAK,EAAC,EAAE;YACtB,OAAO,CAAC,KAAK,GAAG,cAAc,CAAC,MAAM,CAAC,KAAc,CAAC,CAAA;YAErD,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAA;QAChD,CAAC;QAED,gBAAgB,EAAE,KAAK,EAAC,OAAO,EAAC,EAAE;YAChC,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAA;YAElD,OAAO,CAAC,OAAO,GAAG,CAAC,OAAO,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAqB,CAAA;YACzE,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,IAAc,CAAA;YAE7C,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,kBAAkB,CAAA;YACrE,OAAO,CAAC,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,iBAAiB,CAAA;YAEnE,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAsC,WAAW,CAAC,CAAA;YACnF,MAAM,
|
|
1
|
+
{"version":3,"file":"control.js","sourceRoot":"","sources":["../../../../src/manager/components/authentication/control.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EAAE,aAAa,EAAE,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,QAAQ,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAA;YACzC,CAAC;QACH,CAAC;QAED,IAAI,EAAE,KAAK,IAAI,EAAE;YACf,MAAM,KAAK,GAAG,YAAY,CAAA;YAC1B,IAAI,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC9B,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAc,KAAK,CAAC,CAAA;gBAChD,MAAM,IAAI,CAAC,KAAK,EAAE,CAAA;gBAClB,IAAI,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;oBACxB,OAAO,IAAI,CAAA;gBACb,CAAC;YACH,CAAC;YAED,OAAO,IAAI,CAAA;QACb,CAAC;KACF,CAAA;IAED,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { AllowanceRequest, AllowanceResponse, AuthCredentials, AuthenticationStage, AuthenticationType, AuthToken } from '@owlmeans/auth';
|
|
2
|
-
import type {
|
|
2
|
+
import type { EntrypointContextParams } from '@owlmeans/client';
|
|
3
3
|
import type { FC } from 'react';
|
|
4
4
|
import type { ClientContext } from '@owlmeans/client';
|
|
5
5
|
import type { FlowService } from '@owlmeans/client-flow';
|
|
6
6
|
import type { ResilientError } from '@owlmeans/error';
|
|
7
7
|
export type ClientAuthType = AuthenticationType | string;
|
|
8
|
-
export interface AuthenticationProps extends
|
|
8
|
+
export interface AuthenticationProps extends EntrypointContextParams {
|
|
9
9
|
type?: ClientAuthType;
|
|
10
10
|
callback?: AuthenticationCallback;
|
|
11
11
|
source?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/manager/components/authentication/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAAE,iBAAiB,EAAE,eAAe,EAAE,mBAAmB,EAAE,kBAAkB,EAC7F,SAAS,EACV,MAAM,gBAAgB,CAAA;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QAAQ,GAAG,YAAY,CAAC,EACrF,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,SAAS,CAAC,CAAA;CACtB;AAED,MAAM,WAAW,sBAAsB;IACrC,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CACrD"}
|
|
@@ -2,9 +2,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { AuthenticationType } from '@owlmeans/auth';
|
|
3
3
|
import { AuthenticationHOC } from './authentication/component.js';
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { useEntrypoint } from '@owlmeans/client';
|
|
6
6
|
export const TunnelConsumer = ({ ...props }) => {
|
|
7
|
-
const mod =
|
|
7
|
+
const mod = useEntrypoint();
|
|
8
8
|
const Implementation = useMemo(() => AuthenticationHOC(undefined, AuthenticationType.WalletConsumer), []);
|
|
9
9
|
return _jsx(Implementation, { ...mod, ...props, type: AuthenticationType.WalletConsumer });
|
|
10
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tunnel-consumer.js","sourceRoot":"","sources":["../../../src/manager/components/tunnel-consumer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AAEjE,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"tunnel-consumer.js","sourceRoot":"","sources":["../../../src/manager/components/tunnel-consumer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AAEjE,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAGhD,MAAM,CAAC,MAAM,cAAc,GAA2C,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IACrF,MAAM,GAAG,GAAG,aAAa,EAAE,CAAA;IAC3B,MAAM,cAAc,GAAG,OAAO,CAC5B,GAAG,EAAE,CAAC,iBAAiB,CAAC,SAAS,EAAE,kBAAkB,CAAC,cAAc,CAAC,EAAE,EAAE,CAC1E,CAAA;IAED,OAAO,KAAC,cAAc,OAAK,GAAG,KAAM,KAAK,EAAE,IAAI,EAAE,kBAAkB,CAAC,cAAc,GAAG,CAAA;AACvF,CAAC,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Browser entrypoints for the manager's authentication flows. */
|
|
2
|
+
export declare const entrypoints: (import("@owlmeans/client-entrypoint").ClientProtocolEntrypoint<import("@owlmeans/entrypoint").EntrypointProtocol<import("@owlmeans/entrypoint").OpenRequest, import("@owlmeans/entrypoint").OpenValue>> | import("@owlmeans/client-entrypoint").ClientProtocolEntrypoint<import("@owlmeans/entrypoint").EntrypointProtocol<{
|
|
3
|
+
body: import("@owlmeans/auth").AllowanceRequest;
|
|
4
|
+
}, import("@owlmeans/auth").AllowanceResponse>> | import("@owlmeans/client-entrypoint").ClientProtocolEntrypoint<import("@owlmeans/entrypoint").EntrypointProtocol<{
|
|
5
|
+
body: import("@owlmeans/auth").AuthCredentials;
|
|
6
|
+
}, import("@owlmeans/auth").AuthToken>> | import("@owlmeans/client-entrypoint").ClientProtocolEntrypoint<import("@owlmeans/entrypoint").EntrypointProtocol<{
|
|
7
|
+
query: Partial<import("@owlmeans/auth").AuthToken>;
|
|
8
|
+
}, undefined>> | import("@owlmeans/client-entrypoint").ClientProtocolEntrypoint<import("@owlmeans/entrypoint").EntrypointProtocol<{
|
|
9
|
+
query: import("@owlmeans/auth").AuthToken;
|
|
10
|
+
}, undefined>>)[];
|
|
11
|
+
//# sourceMappingURL=entrypoints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entrypoints.d.ts","sourceRoot":"","sources":["../../src/manager/entrypoints.ts"],"names":[],"mappings":"AAMA,kEAAkE;AAClE,eAAO,MAAM,WAAW;;;;;;;;iBAUvB,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { authProtocols } from '@owlmeans/auth-common';
|
|
2
|
+
import { handler } from '@owlmeans/client';
|
|
3
|
+
import { bind, bindScreen, stab } from '@owlmeans/client-entrypoint';
|
|
4
|
+
import { AuthenticationHOC } from './components/authentication/component.js';
|
|
5
|
+
/** Browser entrypoints for the manager's authentication flows. */
|
|
6
|
+
export const entrypoints = [
|
|
7
|
+
bind(authProtocols.authen),
|
|
8
|
+
bind(authProtocols.init),
|
|
9
|
+
bind(authProtocols.authenticate),
|
|
10
|
+
bind(authProtocols.rely),
|
|
11
|
+
bind(authProtocols.client),
|
|
12
|
+
bind(authProtocols.login),
|
|
13
|
+
bindScreen(authProtocols.loginDefault, handler(AuthenticationHOC())),
|
|
14
|
+
bindScreen(authProtocols.loginTyped, handler(AuthenticationHOC())),
|
|
15
|
+
bindScreen(authProtocols.dispatcher, stab),
|
|
16
|
+
];
|
|
17
|
+
//# sourceMappingURL=entrypoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entrypoints.js","sourceRoot":"","sources":["../../src/manager/entrypoints.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAA;AAE5E,kEAAkE;AAClE,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;IAC1B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;IACxB,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC;IAChC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;IACxB,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;IAC1B,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;IACzB,UAAU,CAAC,aAAa,CAAC,YAAY,EAAE,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;IACpE,UAAU,CAAC,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAClE,UAAU,CAAC,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC;CAC3C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basic-ed25519.d.ts","sourceRoot":"","sources":["../../../src/manager/plugins/basic-ed25519.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAKtD,eAAO,MAAM,oBAAoB,EAAE,
|
|
1
|
+
{"version":3,"file":"basic-ed25519.d.ts","sourceRoot":"","sources":["../../../src/manager/plugins/basic-ed25519.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAKtD,eAAO,MAAM,oBAAoB,EAAE,oBA0ClC,CAAA"}
|
|
@@ -5,6 +5,11 @@ import { makeKeyPairModel } from '@owlmeans/basic-keys';
|
|
|
5
5
|
import { AuthenCredError } from '../errors.js';
|
|
6
6
|
export const ed25519BasicUIPlugin = {
|
|
7
7
|
type: AuthenticationType.BasicEd25519,
|
|
8
|
+
method: { order: 300, icon: 'key', emphasis: 'secondary' },
|
|
9
|
+
// This package ships no UI family, so the form below is a `Renderer` a panel package assigns
|
|
10
|
+
// (`@owlmeans/web-panel/auth/plugins`, `@owlmeans/mui-panel/auth/plugins`). Until one does, the
|
|
11
|
+
// Implementation throws on mount — so the sign-in screen must not offer the method.
|
|
12
|
+
requiresRenderer: true,
|
|
8
13
|
Implementation: Renderer => ({ type, stage, control, params }) => {
|
|
9
14
|
type = type ?? AuthenticationType.BasicEd25519;
|
|
10
15
|
Renderer = Renderer ?? ed25519BasicUIPlugin.Renderer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basic-ed25519.js","sourceRoot":"","sources":["../../../src/manager/plugins/basic-ed25519.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAExE,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE9C,MAAM,CAAC,MAAM,oBAAoB,GAAyB;IACxD,IAAI,EAAE,kBAAkB,CAAC,YAAY;IAErC,cAAc,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE;QAE/D,IAAI,GAAG,IAAI,IAAI,kBAAkB,CAAC,YAAY,CAAA;QAC9C,QAAQ,GAAG,QAAQ,IAAI,oBAAoB,CAAC,QAAQ,CAAA;QAEpD,iEAAiE;QACjE,+CAA+C;QAC/C,SAAS,CAAC,GAAG,EAAE;YACb,IAAI,OAAO,CAAC,KAAK,KAAK,mBAAmB,CAAC,IAAI,EAAE,CAAC;gBAC/C,KAAK,OAAO,CAAC,gBAAgB,EAAE,CAAA;YACjC,CAAC;QACH,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;QAEV,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;YACrB,MAAM,IAAI,WAAW,CAAC,iDAAiD,CAAC,CAAA;QAC1E,CAAC;QAED,OAAO,KAAC,QAAQ,IAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,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"file":"exports.d.ts","sourceRoot":"","sources":["../../../src/manager/plugins/exports.ts"],"names":[],"mappings":"AAAA,mBAAmB,YAAY,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../../../src/manager/plugins/exports.ts"],"names":[],"mappings":"AACA,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA"}
|
|
1
|
+
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../../../src/manager/plugins/exports.ts"],"names":[],"mappings":"AACA,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA"}
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { AuthenticationPlugin } from './types.js';
|
|
3
|
-
export declare const plugins: {
|
|
4
|
-
[type: ClientAuthType]: AuthenticationPlugin;
|
|
5
|
-
};
|
|
1
|
+
export { plugins, registerAuthPlugin, getAuthPlugin, listAuthPlugins } from './registry.js';
|
|
6
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/manager/plugins/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/manager/plugins/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -2,8 +2,16 @@ import { AuthenticationType } from '@owlmeans/auth';
|
|
|
2
2
|
import { ed25519BasicUIPlugin } from './basic-ed25519.js';
|
|
3
3
|
import { reCaptchaPlugin } from './re-captcha.js';
|
|
4
4
|
import { tunnelConsumerUIPlugin } from './tunnel-consumer.js';
|
|
5
|
-
|
|
5
|
+
import { pluginMethodSource } from './methods.js';
|
|
6
|
+
import { registerMethodSource } from '../../login/methods.js';
|
|
7
|
+
import { plugins } from './registry.js';
|
|
8
|
+
export { plugins, registerAuthPlugin, getAuthPlugin, listAuthPlugins } from './registry.js';
|
|
6
9
|
plugins[AuthenticationType.BasicEd25519] = ed25519BasicUIPlugin;
|
|
7
10
|
plugins[AuthenticationType.ReCaptcha] = reCaptchaPlugin;
|
|
8
11
|
plugins[AuthenticationType.WalletConsumer] = tunnelConsumerUIPlugin;
|
|
12
|
+
// Registered from here, not from `login/`, so that importing `@owlmeans/client-auth/login` never
|
|
13
|
+
// drags this module's React plugin implementations into a bundle that only wanted the login host.
|
|
14
|
+
// A generated application imports the login subpath through `client-iam`; it must not gain three
|
|
15
|
+
// authentication methods it never registered as a side effect of that.
|
|
16
|
+
registerMethodSource(pluginMethodSource);
|
|
9
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/manager/plugins/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/manager/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAE3F,OAAO,CAAC,kBAAkB,CAAC,YAAY,CAAC,GAAG,oBAAoB,CAAA;AAC/D,OAAO,CAAC,kBAAkB,CAAC,SAAS,CAAC,GAAG,eAAe,CAAA;AACvD,OAAO,CAAC,kBAAkB,CAAC,cAAc,CAAC,GAAG,sBAAsB,CAAA;AAEnE,iGAAiG;AACjG,kGAAkG;AAClG,iGAAiG;AACjG,uEAAuE;AACvE,oBAAoB,CAAC,kBAAkB,CAAC,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { LoginMethodSource } from '../../login/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Every registered authentication plugin that declares itself offerable, as a sign-in method.
|
|
4
|
+
*/
|
|
5
|
+
export declare const pluginMethodSource: LoginMethodSource;
|
|
6
|
+
//# sourceMappingURL=methods.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods.d.ts","sourceRoot":"","sources":["../../../src/manager/plugins/methods.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAmC,iBAAiB,EAAgB,MAAM,sBAAsB,CAAA;AA6B5G;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,iBAsChC,CAAA"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { CAUTHEN_AUTHEN_TYPED } from '@owlmeans/auth';
|
|
2
|
+
import { DEFAULT_METHOD_ORDER, LOGIN_SERVICE } from '../../login/consts.js';
|
|
3
|
+
import { listAuthPlugins } from './registry.js';
|
|
4
|
+
/**
|
|
5
|
+
* Whether a registered plugin may be put on the sign-in screen of THIS application.
|
|
6
|
+
*
|
|
7
|
+
* The registry is global and is filled by side-effect imports, so "registered" means only that
|
|
8
|
+
* some module was pulled into the bundle — three separate reasons why that is not enough:
|
|
9
|
+
*
|
|
10
|
+
* 1. No `method`: `re-captcha` is a STEP inside another flow, not a way to sign in.
|
|
11
|
+
* 2. No renderer: a plugin that declares `requiresRenderer` throws the moment its screen mounts
|
|
12
|
+
* unless a UI package (`web-panel`, `mui-panel`) assigned one. An app that imported the plugin
|
|
13
|
+
* host without that package would be offering buttons whose only outcome is a broken page.
|
|
14
|
+
* 3. Not wired: a plugin whose flow needs a service its context never appended fails on the
|
|
15
|
+
* lookup instead. Packages register their plugins in groups, so an app that wanted one of them
|
|
16
|
+
* gets the rest too, and the rest have to be able to say they do not apply here.
|
|
17
|
+
*/
|
|
18
|
+
const offerable = (plugin, ctx) => {
|
|
19
|
+
if (plugin.method == null || plugin.method.hidden === true) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
if (plugin.requiresRenderer === true && plugin.Renderer == null) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
return plugin.method.available?.(ctx) !== false;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Every registered authentication plugin that declares itself offerable, as a sign-in method.
|
|
29
|
+
*/
|
|
30
|
+
export const pluginMethodSource = {
|
|
31
|
+
alias: 'authentication-plugins',
|
|
32
|
+
list: ctx => listAuthPlugins()
|
|
33
|
+
.filter(plugin => offerable(plugin, ctx))
|
|
34
|
+
.map((plugin) => {
|
|
35
|
+
const meta = plugin.method;
|
|
36
|
+
const type = plugin.type;
|
|
37
|
+
const id = meta.id ?? type;
|
|
38
|
+
return {
|
|
39
|
+
id, type,
|
|
40
|
+
...(meta.label != null ? { label: meta.label } : {}),
|
|
41
|
+
i18nKey: meta.i18nKey ?? id,
|
|
42
|
+
...(meta.icon != null ? { icon: meta.icon } : {}),
|
|
43
|
+
order: meta.order ?? DEFAULT_METHOD_ORDER,
|
|
44
|
+
...(meta.emphasis != null ? { emphasis: meta.emphasis } : {}),
|
|
45
|
+
...(meta.restricted === true ? { restricted: true } : {}),
|
|
46
|
+
params: { type },
|
|
47
|
+
// Non-async through the whole chain: `login.begin` opens the surrogate window in its first
|
|
48
|
+
// statement, and a window opened after the gesture has been handled is blocked.
|
|
49
|
+
start: methodCtx => {
|
|
50
|
+
const login = methodCtx.context.service(LOGIN_SERVICE);
|
|
51
|
+
const entrypoint = methodCtx.context.entrypoint(CAUTHEN_AUTHEN_TYPED);
|
|
52
|
+
const url = entrypoint.path().replace(':type', encodeURIComponent(type));
|
|
53
|
+
return login.begin({
|
|
54
|
+
url,
|
|
55
|
+
// In an ordinary tab this keeps the application mounted, exactly as the pre-chooser
|
|
56
|
+
// dispatcher did; the surrogate plugin ignores it and opens a window instead.
|
|
57
|
+
...(methodCtx.navigate != null
|
|
58
|
+
? { navigate: () => methodCtx.navigate?.(CAUTHEN_AUTHEN_TYPED, { type }) }
|
|
59
|
+
: {}),
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}),
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=methods.js.map
|