@owlmeans/client-auth 0.1.18-rc.57 → 0.1.18-rc.59
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 +21 -20
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/client-auth/SKILL.md +48 -28
- package/build/components/dispatcher/component.js +3 -3
- package/build/components/dispatcher/component.js.map +1 -1
- package/build/entrypoints.d.ts +4 -2
- package/build/entrypoints.d.ts.map +1 -1
- package/build/helper.d.ts.map +1 -1
- package/build/helper.js +2 -2
- package/build/helper.js.map +1 -1
- package/build/login/adopt/types.d.ts +26 -0
- package/build/login/adopt/types.d.ts.map +1 -0
- package/build/login/adopt/types.js +2 -0
- package/build/login/adopt/types.js.map +1 -0
- package/build/login/adopt.d.ts +6 -20
- package/build/login/adopt.d.ts.map +1 -1
- package/build/login/adopt.js +15 -25
- package/build/login/adopt.js.map +1 -1
- package/build/login/consts.d.ts +6 -0
- package/build/login/consts.d.ts.map +1 -1
- package/build/login/consts.js +6 -0
- package/build/login/consts.js.map +1 -1
- package/build/login/consts.local.d.ts +3 -0
- package/build/login/consts.local.d.ts.map +1 -1
- package/build/login/consts.local.js +5 -0
- package/build/login/consts.local.js.map +1 -1
- package/build/login/credit/types.d.ts +7 -0
- package/build/login/credit/types.d.ts.map +1 -0
- package/build/login/credit/types.js +2 -0
- package/build/login/credit/types.js.map +1 -0
- package/build/login/credit.d.ts +1 -1
- package/build/login/credit.d.ts.map +1 -1
- package/build/login/env/types.d.ts +35 -0
- package/build/login/env/types.d.ts.map +1 -0
- package/build/login/env/types.js +2 -0
- package/build/login/env/types.js.map +1 -0
- package/build/login/env.d.ts +5 -29
- package/build/login/env.d.ts.map +1 -1
- package/build/login/env.js +63 -80
- package/build/login/env.js.map +1 -1
- package/build/login/hook.d.ts +15 -0
- package/build/login/hook.d.ts.map +1 -1
- package/build/login/hook.js +25 -7
- package/build/login/hook.js.map +1 -1
- package/build/login/i18n.js +9 -9
- package/build/login/i18n.js.map +1 -1
- package/build/login/index.d.ts +10 -0
- package/build/login/index.d.ts.map +1 -1
- package/build/login/index.js +1 -0
- package/build/login/index.js.map +1 -1
- package/build/login/land/types.d.ts +52 -0
- package/build/login/land/types.d.ts.map +1 -0
- package/build/login/land/types.js +2 -0
- package/build/login/land/types.js.map +1 -0
- package/build/login/land.d.ts +5 -34
- package/build/login/land.d.ts.map +1 -1
- package/build/login/land.js +88 -122
- package/build/login/land.js.map +1 -1
- package/build/login/methods/types.d.ts +30 -0
- package/build/login/methods/types.d.ts.map +1 -0
- package/build/login/methods/types.js +2 -0
- package/build/login/methods/types.js.map +1 -0
- package/build/login/methods.d.ts +5 -23
- package/build/login/methods.d.ts.map +1 -1
- package/build/login/methods.js +67 -79
- package/build/login/methods.js.map +1 -1
- package/build/login/resume/types.d.ts +24 -0
- package/build/login/resume/types.d.ts.map +1 -0
- package/build/login/resume/types.js +2 -0
- package/build/login/resume/types.js.map +1 -0
- package/build/login/resume.d.ts +5 -17
- package/build/login/resume.d.ts.map +1 -1
- package/build/login/resume.js +35 -44
- package/build/login/resume.js.map +1 -1
- package/build/login/screen.d.ts.map +1 -1
- package/build/login/screen.js +9 -9
- package/build/login/screen.js.map +1 -1
- package/build/login/service.d.ts.map +1 -1
- package/build/login/service.js +61 -18
- package/build/login/service.js.map +1 -1
- package/build/login/start/types.d.ts +29 -0
- package/build/login/start/types.d.ts.map +1 -0
- package/build/login/start/types.js +2 -0
- package/build/login/start/types.js.map +1 -0
- package/build/login/start.d.ts +5 -0
- package/build/login/start.d.ts.map +1 -0
- package/build/login/start.js +36 -0
- package/build/login/start.js.map +1 -0
- package/build/login/surrogate/types.d.ts +9 -0
- package/build/login/surrogate/types.d.ts.map +1 -0
- package/build/login/surrogate/types.js +2 -0
- package/build/login/surrogate/types.js.map +1 -0
- package/build/login/surrogate.d.ts +2 -1
- package/build/login/surrogate.d.ts.map +1 -1
- package/build/login/surrogate.js.map +1 -1
- package/build/login/terms/types.d.ts +108 -0
- package/build/login/terms/types.d.ts.map +1 -0
- package/build/login/terms/types.js +2 -0
- package/build/login/terms/types.js.map +1 -0
- package/build/login/terms.d.ts +13 -53
- package/build/login/terms.d.ts.map +1 -1
- package/build/login/terms.js +209 -234
- package/build/login/terms.js.map +1 -1
- package/build/login/types.d.ts +16 -79
- package/build/login/types.d.ts.map +1 -1
- package/build/manager/entrypoints.d.ts +9 -1
- package/build/manager/entrypoints.d.ts.map +1 -1
- package/build/manager/plugins/exports.d.ts +1 -0
- package/build/manager/plugins/exports.d.ts.map +1 -1
- package/build/manager/plugins/exports.js.map +1 -1
- package/build/manager/plugins/index.d.ts +2 -1
- package/build/manager/plugins/index.d.ts.map +1 -1
- package/build/manager/plugins/index.js +3 -3
- package/build/manager/plugins/index.js.map +1 -1
- package/build/manager/plugins/methods.js +2 -2
- package/build/manager/plugins/methods.js.map +1 -1
- package/build/manager/plugins/registry/types.d.ts +10 -0
- package/build/manager/plugins/registry/types.d.ts.map +1 -0
- package/build/manager/plugins/registry/types.js +2 -0
- package/build/manager/plugins/registry/types.js.map +1 -0
- package/build/manager/plugins/registry.d.ts +4 -4
- package/build/manager/plugins/registry.d.ts.map +1 -1
- package/build/manager/plugins/registry.js +10 -6
- package/build/manager/plugins/registry.js.map +1 -1
- package/build/manager/plugins/tunnel-consumer.js +2 -2
- package/build/manager/plugins/tunnel-consumer.js.map +1 -1
- package/package.json +23 -23
- package/src/components/dispatcher/component.tsx +4 -4
- package/src/helper.ts +2 -2
- package/src/login/adopt/types.ts +25 -0
- package/src/login/adopt.ts +20 -25
- package/src/login/consts.local.ts +6 -0
- package/src/login/consts.ts +7 -0
- package/src/login/credit/types.ts +6 -0
- package/src/login/credit.ts +1 -1
- package/src/login/env/types.ts +35 -0
- package/src/login/env.ts +60 -72
- package/src/login/hook.ts +28 -7
- package/src/login/i18n.ts +10 -9
- package/src/login/index.ts +10 -0
- package/src/login/land/types.ts +54 -0
- package/src/login/land.ts +95 -129
- package/src/login/methods/types.ts +32 -0
- package/src/login/methods.ts +75 -82
- package/src/login/resume/types.ts +24 -0
- package/src/login/resume.ts +39 -42
- package/src/login/screen.tsx +13 -14
- package/src/login/service.ts +73 -19
- package/src/login/start/types.ts +30 -0
- package/src/login/start.ts +44 -0
- package/src/login/surrogate/types.ts +9 -0
- package/src/login/surrogate.ts +2 -1
- package/src/login/terms/types.ts +122 -0
- package/src/login/terms.ts +256 -259
- package/src/login/types.ts +14 -87
- package/src/manager/README.md +1 -1
- package/src/manager/plugins/exports.ts +1 -0
- package/src/manager/plugins/index.ts +4 -3
- package/src/manager/plugins/methods.ts +2 -2
- package/src/manager/plugins/registry/types.ts +10 -0
- package/src/manager/plugins/registry.ts +15 -8
- package/src/manager/plugins/tunnel-consumer.tsx +2 -2
- package/tests/land.spec.ts +19 -19
- package/tests/login.spec.ts +34 -34
- package/tests/target.spec.ts +210 -0
- package/tests/terms-deferred.spec.ts +6 -6
- package/tests/terms.spec.ts +31 -31
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ legacy). The server-side counterpart is `@owlmeans/server-auth`.
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
bun add @owlmeans/client-auth@^0.1.18-rc.
|
|
15
|
+
bun add @owlmeans/client-auth@^0.1.18-rc.59
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
## Concepts
|
|
@@ -31,10 +31,10 @@ bun add @owlmeans/client-auth@^0.1.18-rc.57
|
|
|
31
31
|
(embedded, surrogate) and priority. `@owlmeans/web-client` registers the redirect and surrogate
|
|
32
32
|
plugins.
|
|
33
33
|
- **Login method** — one offerable button. `LoginMethodSource`s produce candidates;
|
|
34
|
-
`resolveLoginMethods` drops restricted ones the config did not name and applies the configured
|
|
34
|
+
`loginMethodsHelper.resolveLoginMethods` drops restricted ones the config did not name and applies the configured
|
|
35
35
|
order.
|
|
36
36
|
- **Login outcome** — `LoginOutcome` (`Handled`, `Passed`, `Redirected`, `Gesture`, `Orphaned`,
|
|
37
|
-
`Failed`) tells the caller what to do next. `resumeAction` and
|
|
37
|
+
`Failed`) tells the caller what to do next. `loginResumeHelper.resumeAction` and `.loginAttemptError` are the only
|
|
38
38
|
readings of it.
|
|
39
39
|
|
|
40
40
|
## Usage
|
|
@@ -69,7 +69,7 @@ export const clientBindings = [
|
|
|
69
69
|
### 2. Guarding a layout and reading the identity
|
|
70
70
|
|
|
71
71
|
```tsx
|
|
72
|
-
import {
|
|
72
|
+
import { authHelper } from '@owlmeans/auth'
|
|
73
73
|
import { useSelfAuth } from '@owlmeans/client-auth'
|
|
74
74
|
import type { FC, PropsWithChildren } from 'react'
|
|
75
75
|
import { useContext } from '../context.js'
|
|
@@ -85,7 +85,7 @@ export const UserLayout: FC<PropsWithChildren> = ({ children }) => {
|
|
|
85
85
|
|
|
86
86
|
const auth = context.auth().user()
|
|
87
87
|
// The organization is its renameable entitySlug; the stable entityId never reaches the browser.
|
|
88
|
-
const organization = entitySlugOf(auth)
|
|
88
|
+
const organization = authHelper.entitySlugOf(auth)
|
|
89
89
|
|
|
90
90
|
return <main data-organization={organization}>{children}</main>
|
|
91
91
|
}
|
|
@@ -157,7 +157,7 @@ export const appendPartnerLogin = <C extends Config, T extends Context<C>>(conte
|
|
|
157
157
|
```tsx
|
|
158
158
|
import { AuthenticationStage } from '@owlmeans/auth'
|
|
159
159
|
import type { AuthenticationRendererProps } from '@owlmeans/client-auth/manager'
|
|
160
|
-
import {
|
|
160
|
+
import { authPluginHelper } from '@owlmeans/client-auth/manager/plugins'
|
|
161
161
|
import type { AuthenticationPlugin } from '@owlmeans/client-auth/manager/plugins'
|
|
162
162
|
import { useEffect } from 'react'
|
|
163
163
|
|
|
@@ -183,7 +183,7 @@ export const passkeyPlugin: AuthenticationPlugin = {
|
|
|
183
183
|
},
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
registerAuthPlugin(passkeyPlugin)
|
|
186
|
+
authPluginHelper.registerAuthPlugin(passkeyPlugin)
|
|
187
187
|
```
|
|
188
188
|
|
|
189
189
|
A UI package then assigns `plugins[MY_APP_PASSKEY].Renderer`, and the renderer calls
|
|
@@ -215,7 +215,7 @@ Importing it registers `basic-ed25519`, `re-captcha` and `wallet-consumer`, plus
|
|
|
215
215
|
|
|
216
216
|
| Symbol | Kind | Purpose |
|
|
217
217
|
|---|---|---|
|
|
218
|
-
| `plugins`, `registerAuthPlugin`, `getAuthPlugin`, `listAuthPlugins` | registry | The module-global authentication-plugin registry |
|
|
218
|
+
| `plugins`, `authPluginHelper` (`registerAuthPlugin`, `getAuthPlugin`, `listAuthPlugins`), `AuthPluginHelper` | registry | The module-global authentication-plugin registry |
|
|
219
219
|
| `AuthenticationHOC(Renderer?, type?)` | HOC | The authentication screen hosting a plugin |
|
|
220
220
|
| `AuthenticationProps`, `TAuthenticationHOC` | type | Screen props (`type?`, `callback?`, `source?`) |
|
|
221
221
|
| `makeControl(context, callback?)` | function | The control a plugin drives: `requestAllowence`, `authenticate`, `persist` / `restore` / `hasPersistentState` / `cleanUpState`, `setError`, `flow` |
|
|
@@ -240,7 +240,7 @@ The plugin-authoring surface, with no registration side effect.
|
|
|
240
240
|
| `AuthenticationPlugin` | type | `type`, `Implementation`, `Renderer?`, `requiresRenderer?`, `method?`, `authenticate` / `beforeAuthenticate` / `afterAuthenticate` |
|
|
241
241
|
| `PluginImplemnetation` (sic) | type | `(Renderer?) => FC<AuthenticationRendererProps>` |
|
|
242
242
|
| `AuthMethodMeta` | type | `id`, `label`, `i18nKey`, `icon`, `order`, `emphasis`, `restricted`, `hidden`, `available(ctx)` |
|
|
243
|
-
| `plugins`, `
|
|
243
|
+
| `plugins`, `authPluginHelper`, `AuthPluginHelper` | registry | Same registry as `./manager` |
|
|
244
244
|
| `pluginMethodSource` | const | The `LoginMethodSource` that offers registered plugins |
|
|
245
245
|
| `createWalletFacade`, `PinSchema`, `PinForm`, `TunnelAuthenticationRenderer`, `TunnelAuthenticationRendererProps` | function, const, type | Wallet-tunnel helpers |
|
|
246
246
|
| `ed25519BasicUIPlugin`, `reCaptchaPlugin`, `tunnelConsumerUIPlugin` | const | Shipped plugin objects |
|
|
@@ -256,18 +256,19 @@ The plugin-authoring surface, with no registration side effect.
|
|
|
256
256
|
| `LoginOutcome`, `LoginIntent` | enum | Stage results; login or logout surrogate |
|
|
257
257
|
| `useLogin(target?)` | hook | `[dispatcherPath, onLogIn]` |
|
|
258
258
|
| `useLogout(target?)` | hook | `onLogOut` |
|
|
259
|
-
| `registerMethodSource`,
|
|
259
|
+
| `loginMethodsHelper` — `.registerMethodSource`, `.listMethodSources`, `.resolveLoginMethods(ctx, cfg?, extra?)`, `.primaryLoginMethod(methods)`; `LoginMethodsHelper` | helper, type | Global method sources and resolution |
|
|
260
260
|
| `LoginMethod`, `LoginMethodSource`, `LoginMethodContext` | type | Method contract |
|
|
261
|
-
| `resolveTerms(cfg?)`,
|
|
262
|
-
| `termsLabelResolver(translate, locale)`,
|
|
263
|
-
| `termsDeferred(ctx)` |
|
|
261
|
+
| `loginTermsHelper` — `.resolveTerms(cfg?)`, `.termsAccepted(resolved)`, `.acceptTerms(resolved, accepted)`; `LoginTermsHelper`, `ResolvedTerms` | helper, type | Terms confirmation, stored in `localStorage` against a version derived from the URLs |
|
|
262
|
+
| `loginTermsHelper` — `.termsLabelResolver(translate, locale)`, `.termsAcceptanceOf(resolved, locale?)`; `LoginTermsAcceptance`, `TermsAcceptanceRef` | helper, type | The one document-label resolver every terms renderer shares; the wire shape a sign-in-time acceptance sends the server (structurally `@owlmeans/marketing-consent`'s `TermsAcceptance`, no dependency on it) |
|
|
263
|
+
| `loginTermsHelper.termsDeferred(ctx)` | helper | True once a registered AND bound `LoginStep` declares `confirmsTerms` — the sign-in screen then renders no checkbox and blocks nothing, because the confirmation lives on that step instead |
|
|
264
264
|
| `resolveCredit(cfg?, brand?, service?)`, `ResolvedCredit` | function, type | The credit and copyright line |
|
|
265
265
|
| `FallbackLoginScreen`, `LoginScreenProps`, `LoginScreenComponent` | component, type | The plain screen used when no UI family registered one |
|
|
266
266
|
| `surrogatePath(ctx, target)`, `SurrogateTarget` | function, type | Where a surrogate window opens; `null` on an entrypoint list without the surrogate route |
|
|
267
|
-
| `resumeAction(outcome)`,
|
|
267
|
+
| `loginResumeHelper` — `.resumeAction(outcome)`, `.loginAttemptError(outcome)`; `LoginResumeHelper`, `ResumeAction` | helper, enum | The shared readings of a `resume` outcome and of a finished attempt |
|
|
268
268
|
| `enterOidcAuthorization(model)` | function | Move a flow to the step that can authorize; idempotent |
|
|
269
|
-
| `
|
|
270
|
-
| `
|
|
269
|
+
| `loginTokenOf(ctx)` — `.adoptToken(token)`, `.revokeToken()`; `makeLoginTokenHelper`, `LoginTokenHelper` | helper | The single adoption and de-adoption paths |
|
|
270
|
+
| `loginLandingOf(ctx)` — `.landAfterLogin(opts?)`, `.continueLogin(opts?)`, `.landingUrl(landing)`; `makeLoginLandingHelper`, `LoginLandingHelper`, `useContinueLogin()` | helper, hook | Where a finished sign-in lands: pending steps, landing hooks, a suspended flow, else the fallback |
|
|
271
|
+
| `loginEnvHelper` — `isEmbedded`, `isSurrogate`, `markSurrogate`, `clearSurrogate`, `defaultLoginEnv`; `LoginEnvHelper` | helper | Environment probes behind `LoginEnv` |
|
|
271
272
|
| `LOGIN_SERVICE`, `DEFAULT_ALIAS`, `DEFAULT_LOGIN_PRIORITY`, `DEFAULT_METHOD_ORDER`, `LOGIN_SURROGATE_NAME`, `LOGIN_TOKEN_MESSAGE`, `LOGIN_LOGOUT_MESSAGE`, `LOGIN_SURROGATE_MARKER`, `LOGIN_SURROGATE_FEATURES`, `LOGIN_WATCH_INTERVAL`, `LOGIN_INTENT_QUERY`, `LOGIN_NEXT_QUERY`, `LOGIN_METHOD_QUERY`, `LOGIN_TERMS_STORAGE` | const | Service alias, ordering defaults and cross-document wire values |
|
|
272
273
|
|
|
273
274
|
Importing `./login` also registers the `login` strings of the `auth` library namespace in all
|
|
@@ -281,7 +282,7 @@ seven supported languages.
|
|
|
281
282
|
precondition.
|
|
282
283
|
- **Never start login from an effect.** Without a user gesture the window is blocked. Render a
|
|
283
284
|
control and let the person click.
|
|
284
|
-
- **Adopt and drop tokens only through the auth service or `adoptToken` /
|
|
285
|
+
- **Adopt and drop tokens only through the auth service or `loginTokenOf(ctx).adoptToken` / `.revokeToken`.**
|
|
285
286
|
Hand-written access to `AUTH_RESOURCE` drifts from the envelope decoding beside it.
|
|
286
287
|
- **Import names from the right subpath.** The plugin contract (`AuthenticationPlugin`,
|
|
287
288
|
`AuthMethodMeta`, `pluginMethodSource`, tunnel helpers) resolves only through
|
|
@@ -296,14 +297,14 @@ seven supported languages.
|
|
|
296
297
|
- **Authorization stays server-side.** The browser ends up holding an ordinary OwlMeans bearer token
|
|
297
298
|
whichever provider issued it. Product checks live in entrypoint gates and handlers, never in
|
|
298
299
|
client-only state.
|
|
299
|
-
- **The organization on the wire is its `entitySlug`.** Read it with `entitySlugOf` from
|
|
300
|
+
- **The organization on the wire is its `entitySlug`.** Read it with `authHelper.entitySlugOf` from
|
|
300
301
|
`@owlmeans/auth`; the stable `entityId` never reaches the browser.
|
|
301
302
|
- **Overrides of the `login` strings cover all seven languages** (`en`, `pl`, `ru`, `be`, `uk`,
|
|
302
303
|
`es`, `de`).
|
|
303
304
|
|
|
304
305
|
## Related packages
|
|
305
306
|
|
|
306
|
-
- [`@owlmeans/auth`](../auth) — `Auth`, aliases, `entitySlugOf`, auth errors
|
|
307
|
+
- [`@owlmeans/auth`](../auth) — `Auth`, aliases, `authHelper.entitySlugOf`, auth errors
|
|
307
308
|
- [`@owlmeans/auth-common`](../auth-common) — `authProtocols`, `authMiddleware`, guard aliases
|
|
308
309
|
- [`@owlmeans/web-client`](../web-client) — appends the auth service and login host; ships the dispatcher and login plugins
|
|
309
310
|
- [`@owlmeans/web-panel`](../web-panel) — the shadcn sign-in screen (`appendLoginScreen`)
|
|
@@ -321,7 +322,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
|
|
|
321
322
|
your project's skill store (`.agents/skills/`):
|
|
322
323
|
|
|
323
324
|
```sh
|
|
324
|
-
npx @owlmeans/agent-skills@^0.1.18-rc.
|
|
325
|
+
npx @owlmeans/agent-skills@^0.1.18-rc.51
|
|
325
326
|
```
|
|
326
327
|
|
|
327
328
|
The embedded files are version-matched to this package release. Do not edit them
|
package/agent-meta/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"package": "@owlmeans/client-auth",
|
|
4
|
-
"version": "0.1.18-rc.
|
|
5
|
-
"generatedAt": "2026-10-
|
|
4
|
+
"version": "0.1.18-rc.59",
|
|
5
|
+
"generatedAt": "2026-10-06T11:45:57.652Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -8,7 +8,7 @@ user-invocable: false
|
|
|
8
8
|
# @owlmeans/client-auth
|
|
9
9
|
|
|
10
10
|
**Layer:** Client
|
|
11
|
-
**Install:** `"@owlmeans/client-auth": "^0.1.18-rc.
|
|
11
|
+
**Install:** `"@owlmeans/client-auth": "^0.1.18-rc.59"` in `dependencies`
|
|
12
12
|
|
|
13
13
|
Five subpaths, five jobs:
|
|
14
14
|
|
|
@@ -52,7 +52,7 @@ conflate them.
|
|
|
52
52
|
|
|
53
53
|
| Export | Description |
|
|
54
54
|
|--------|-------------|
|
|
55
|
-
| `plugins`, `registerAuthPlugin`,
|
|
55
|
+
| `plugins`, `authPluginHelper` → `.registerAuthPlugin`, `.getAuthPlugin`, `.listAuthPlugins` | The module-global registry |
|
|
56
56
|
| `AuthenticationHOC`, `AuthenticationProps`, `TAuthenticationHOC` | The screen that hosts a plugin's implementation |
|
|
57
57
|
| `makeControl`, `AuthenticationControl`, `AuthenticationControlState` | The control a plugin drives: `requestAllowence`, `authenticate`, and the state it persists across a provider redirect |
|
|
58
58
|
| `AuthenticationRenderer`, `AuthenticationRendererProps`, `ClientAuthType`, `ClientAuthenticationMethod`, `AuthenticationCallback` | Rendering contract |
|
|
@@ -66,7 +66,7 @@ conflate them.
|
|
|
66
66
|
| `AuthenticationPlugin` | `type`, `Implementation`, optional `Renderer`, `requiresRenderer?`, `method?` and the `authenticate` / `beforeAuthenticate` / `afterAuthenticate` hooks |
|
|
67
67
|
| `PluginImplemnetation` (sic) | `(Renderer?) => FC<AuthenticationRendererProps>` — the shape of `Implementation` |
|
|
68
68
|
| `AuthMethodMeta` | How the plugin presents itself as a sign-in method — see `login-methods` |
|
|
69
|
-
| `plugins`, `
|
|
69
|
+
| `plugins`, `authPluginHelper` | The same registry as `./manager` |
|
|
70
70
|
| `pluginMethodSource` | The `LoginMethodSource` that turns registered plugins into offerable methods |
|
|
71
71
|
| `createWalletFacade`, `PinSchema`, `PinForm`, `TunnelAuthenticationRenderer`, `TunnelAuthenticationRendererProps` | Wallet-tunnel helpers a consumer plugin builds on |
|
|
72
72
|
| `ed25519BasicUIPlugin`, `reCaptchaPlugin`, `tunnelConsumerUIPlugin` | The shipped plugin objects |
|
|
@@ -85,24 +85,25 @@ browsing context the round trip can complete at all.
|
|
|
85
85
|
| `appendLogin(ctx)` | Register the host and expose it as `context.login()` |
|
|
86
86
|
| `makeLoginService(alias?)`, `ensureLoginService(ctx)` | The host itself — a **lazy** service, so `makeContext` can reach it at the Loading stage — and the idempotent getter a plugin package calls before `registerPlugin` |
|
|
87
87
|
| `LoginPlugin`, `LoginEnv`, `LoginRequest`, `LogoutRequest`, `LoginOutcome`, `LoginIntent`, `LoginService`, `LoginContext`, `LoginPrecondition` | The contract |
|
|
88
|
-
| `registerMethodSource`,
|
|
88
|
+
| `loginMethodsHelper` → `.registerMethodSource`, `.listMethodSources`, `.resolveLoginMethods`, `.primaryLoginMethod` | Which sign-in methods are offered — see `login-methods` |
|
|
89
89
|
| `LoginMethod`, `LoginMethodSource`, `LoginMethodContext` | Method types |
|
|
90
|
-
| `
|
|
91
|
-
| `LoginStep`, `LoginLanding`, `LoginLandingHook`, `LandOptions`, `LoginLandingParams` | Landing-seam types. `registerStep`/`steps`/`onLanded`/`landingHooks` on `LoginService` are the same replace-by-alias, priority-sorted registries as `registerPlugin`. `LoginStep` also carries `confirmsTerms?: boolean` (this step is where the Terms confirmation lives — see `termsDeferred` below) and `required?: boolean` (a throw/timeout in `pending` reads as PENDING, not "not pending" — see `login-plugins`) |
|
|
90
|
+
| `loginLandingOf(ctx)` → `.landAfterLogin(opts?)`, `.continueLogin(opts?)`, `.landingUrl(landing)`; `useContinueLogin()` | The post-login landing decision (`src/login/land.ts`) — see `login-plugins`. `landAfterLogin` runs due landing hooks then delegates to `continueLogin`, which walks pending `LoginStep`s, then `flowLandingOf(ctx).resumeSuspendedFlow`, then `LandOptions.fallback ?? { alias: HOME }`; `landingUrl` builds the absolute URL a plugin's own `window.location.href` needs; `useContinueLogin()` is what a step's own screen calls once satisfied |
|
|
91
|
+
| `LoginStep`, `LoginLanding`, `LoginLandingHook`, `LandOptions`, `LoginLandingParams` | Landing-seam types. `registerStep`/`steps`/`onLanded`/`landingHooks` on `LoginService` are the same replace-by-alias, priority-sorted registries as `registerPlugin`. `LoginStep` also carries `confirmsTerms?: boolean` (this step is where the Terms confirmation lives — see `loginTermsHelper.termsDeferred` below) and `required?: boolean` (a throw/timeout in `pending` reads as PENDING, not "not pending" — see `login-plugins`) |
|
|
92
92
|
| `LOGIN_STEP_TIMEOUT`, `LOGIN_LANDED_STORAGE` | A step's `pending`/a hook's `landed` is bounded by the former; the latter is where the last-landed token is recorded (the raw string, never a digest) |
|
|
93
|
-
| `resolveTerms`,
|
|
94
|
-
| `termsLabelResolver(translate, locale)`, `termsAcceptanceOf(resolved, locale?)`, `TermsAcceptanceRef` | The ONE document-label resolver and ONE wire-shape builder every terms renderer/recorder shares (`FallbackLoginScreen`, `web-panel`'s `LoginTerms`, `web-marketing-consent`'s Terms box and `termsRecorder`) — no more hand-kept duplicate `DEFAULT_LABEL`/`resolveLabelFor` per package. `termsAcceptanceOf` keeps only `{key, href, revisedAt}` per document — structurally `@owlmeans/marketing-consent`'s `TermsAcceptance`, with no dependency on that package |
|
|
95
|
-
| `termsDeferred(ctx)` | True once a registered AND BOUND `LoginStep` declares `confirmsTerms` — see the "Deferring the confirmation" section of `login-methods`. Reads `ctx.hasService`/`.hasEntrypoint` directly, never `ensureLoginService` (which has the side effect of registering an empty host) |
|
|
93
|
+
| `loginTermsHelper` → `.resolveTerms`, `.termsAccepted`, `.acceptTerms`, `.termsSentence`, `ResolvedTerms`, `ResolvedTermsDocument`, `TermsSentencePart` | The confirmation. `resolveTerms` produces `documents` (what the checkbox agrees to: terms, then billing/product/custom when configured) and `notices` (what is only disclosed: privacy, plus cookies per its own inclusion rule) — see the terms-confirmation section of `login-methods`. The extra `LoginTermsConfig` fields (`billing`, `product`, `documents`, `revisions`, `showRevision`) are added by module augmentation in `src/login/terms-config.ts`, never by editing `@owlmeans/config` — importing anything from `@owlmeans/client-auth/login` pulls it in |
|
|
94
|
+
| `loginTermsHelper.termsLabelResolver(translate, locale)`, `loginTermsHelper.termsAcceptanceOf(resolved, locale?)`, `TermsAcceptanceRef` | The ONE document-label resolver and ONE wire-shape builder every terms renderer/recorder shares (`FallbackLoginScreen`, `web-panel`'s `LoginTerms`, `web-marketing-consent`'s Terms box and `termsRecorder`) — no more hand-kept duplicate `DEFAULT_LABEL`/`resolveLabelFor` per package. `termsAcceptanceOf` keeps only `{key, href, revisedAt}` per document — structurally `@owlmeans/marketing-consent`'s `TermsAcceptance`, with no dependency on that package |
|
|
95
|
+
| `loginTermsHelper.termsDeferred(ctx)` | True once a registered AND BOUND `LoginStep` declares `confirmsTerms` — see the "Deferring the confirmation" section of `login-methods`. Reads `ctx.hasService`/`.hasEntrypoint` directly, never `ensureLoginService` (which has the side effect of registering an empty host) |
|
|
96
96
|
| `resolveCredit`, `ResolvedCredit` | The credit and copyright line |
|
|
97
97
|
| `FallbackLoginScreen`, `LoginScreenProps` (now also carries `locale?: string`, for `Intl.ListFormat` and a custom document's locale-keyed label), `LoginScreenComponent` | The plain sign-in screen a relying party renders when no UI family registered one |
|
|
98
98
|
| `surrogatePath(ctx, target)`, `SurrogateTarget` | Where a surrogate login window opens; `null` on an older entrypoint list |
|
|
99
|
-
| `resumeAction(outcome)`, `ResumeAction`, `loginAttemptError(outcome)` | The one reading of a `resume` outcome, and the one reading of a finished attempt |
|
|
99
|
+
| `loginResumeHelper.resumeAction(outcome)`, `ResumeAction`, `loginResumeHelper.loginAttemptError(outcome)` | The one reading of a `resume` outcome, and the one reading of a finished attempt |
|
|
100
100
|
| `registerNotifier(notifier)` (on `LoginService`), `LoginNotifier` | Surfaces a `begin`/`logout` outcome that has no inline screen to render it on — e.g. a toast on `LoginOutcome.Blocked` for a header "Log in"/"Log out" control. `web-panel`'s `appendLoginScreen` registers a default; unregistered, it is silence |
|
|
101
101
|
| `enterOidcAuthorization(model)` | Move a flow to the step that can authorize — idempotent, call it before every `authenticate` |
|
|
102
|
-
| `adoptToken(
|
|
103
|
-
| `useLogin(target?)`, `useLogout(target?)` | Wiring for a sign-in / sign-out control
|
|
104
|
-
| `
|
|
105
|
-
| `
|
|
102
|
+
| `loginTokenOf(ctx).adoptToken(token)`, `.revokeToken()` | The single adoption and de-adoption paths |
|
|
103
|
+
| `useLogin(target?)`, `useLogout(target?)` | Wiring for a sign-in / sign-out control. `useLogin`'s `target` is the screen to land on AFTER sign-in (parked, never navigated to first); `useLogout`'s is where the document goes once the session is gone |
|
|
104
|
+
| `loginStartOf(ctx).startLogin({ url, target?, go })`, `LoginStart` | The React-free decision behind `useLogin` (`src/login/start.ts`): a target with a session already held goes straight there; otherwise `begin` with the target and a continuation to `DISPATCHER` |
|
|
105
|
+
| `loginEnvHelper` → `.isEmbedded`, `.isSurrogate`, `.markSurrogate`, `.clearSurrogate`, `.defaultLoginEnv` | Environment probes the host builds `LoginEnv` from |
|
|
106
|
+
| `LOGIN_SERVICE`, `LOGIN_SURROGATE_NAME`, `LOGIN_TOKEN_MESSAGE`, `LOGIN_LOGOUT_MESSAGE`, `LOGIN_SURROGATE_MARKER`, `LOGIN_SURROGATE_WIDTH`, `LOGIN_SURROGATE_HEIGHT`, `LOGIN_WATCH_INTERVAL`, `LOGIN_INTENT_QUERY`, `LOGIN_NEXT_QUERY`, `LOGIN_METHOD_QUERY`, `LOGIN_TERMS_STORAGE`, `LOGIN_TARGET_TTL`, `DEFAULT_LOGIN_PRIORITY`, `DEFAULT_METHOD_ORDER` | Aliases and the fixed cross-document wire values. `LOGIN_SURROGATE_FEATURES` also still exports (deprecated, never centered) — `@owlmeans/web-client`'s `centeredPopupFeatures(LOGIN_SURROGATE_WIDTH, LOGIN_SURROGATE_HEIGHT)` is what the surrogate plugin actually opens the window with |
|
|
106
107
|
|
|
107
108
|
```typescript
|
|
108
109
|
import { useLogin, useLogout } from '@owlmeans/client-auth/login'
|
|
@@ -117,13 +118,27 @@ entrypoint **inside** the hook, never at module scope — `DISPATCHER` for `useL
|
|
|
117
118
|
path for `useLogout`. A module body runs before `registerEntrypoints`, so `useLogin`'s lookup at
|
|
118
119
|
top level throws `Entrypoint dispatcher not found` during import, taking the whole render down.
|
|
119
120
|
|
|
120
|
-
`target`
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
`
|
|
121
|
+
`useLogin(target)` signs in FIRST and lands on `target` after, in an ordinary tab (redirect plugin)
|
|
122
|
+
and in a framed application (surrogate popup) alike, with every pending post-sign-in step run on the
|
|
123
|
+
way. Its `navigate` continuation is ALWAYS `DISPATCHER` — never the target, because a guarded screen
|
|
124
|
+
reached before sign-in renders signed out. The target travels as `LoginRequest.target`: the facade's
|
|
125
|
+
`begin`, past the preconditions, parks it with `flowLandingOf(ctx).suspendLanding`
|
|
126
|
+
(`@owlmeans/client-flow`, the `RESUME_FLOW` record its `resumeSuspendedFlow` reads, expiring after
|
|
127
|
+
`LOGIN_TARGET_TTL`) — the write is started, never awaited before the plugin, so a popup still opens
|
|
128
|
+
inside the gesture — and holds the continuation until the write has landed. The dispatcher's
|
|
129
|
+
`landAfterLogin` (landing hooks → pending steps such as a consent screen → the parked target) then
|
|
130
|
+
ends on it. An attempt that signs nobody in (`Blocked`, `Failed`, `Gesture`) discards the parked
|
|
131
|
+
target; a refused precondition never parks it. A session already held (the auth service's in-memory
|
|
132
|
+
`token`) goes straight to the target. Without a target, `useLogin()` is the plain sign-in to the
|
|
133
|
+
ordinary landing. A caller of `login().begin` that passes a `target` without a `navigate` leaves the
|
|
134
|
+
document at once, so its parked target is best-effort.
|
|
135
|
+
|
|
136
|
+
`useLogout` sends a continuation only when a target is given. Omitting it does not leave the session
|
|
137
|
+
behind: the token is revoked either way, and the plugin decides what the document does with no
|
|
138
|
+
continuation to run — `@owlmeans/web-client`'s redirect plugin reloads the page, because cached auth
|
|
139
|
+
reads only forget a session when the application is rebuilt. `useLogin` returns `[path, handler]`
|
|
140
|
+
(the path is the dispatcher's, with or without a target) and `useLogout` a bare handler — a logout
|
|
141
|
+
control has no address to point at.
|
|
127
142
|
|
|
128
143
|
Plugin selection, the shipped browser flows and the full invariant list: the `login-plugins` skill.
|
|
129
144
|
|
|
@@ -145,21 +160,26 @@ a web application only calls these when it builds its context by hand.
|
|
|
145
160
|
## Rules
|
|
146
161
|
|
|
147
162
|
- The bearer token lives in the `AUTH_RESOURCE` resource under the single id `USER_ID`. Read and
|
|
148
|
-
write it through the auth service or through `adoptToken` /
|
|
149
|
-
access drifts from the envelope decoding that happens beside it.
|
|
163
|
+
write it through the auth service or through `loginTokenOf(ctx).adoptToken` / `.revokeToken`;
|
|
164
|
+
hand-written storage access drifts from the envelope decoding that happens beside it.
|
|
150
165
|
- A plugin that persists state across a provider redirect drives the control's own
|
|
151
166
|
`persist()` / `restore()` / `hasPersistentState()` / `cleanUpState()`. They keep the type, stage
|
|
152
167
|
and allowance in the `FLOW_STATE` resource under an id this package owns and does not export —
|
|
153
168
|
restore before submitting the credential, and clean up after.
|
|
154
|
-
- After a sign-in, `DispatcherHOC.navigate` calls `landAfterLogin` — a pending
|
|
155
|
-
landing suspended in `@owlmeans/client-flow`
|
|
156
|
-
|
|
157
|
-
|
|
169
|
+
- After a sign-in, `DispatcherHOC.navigate` calls `loginLandingOf(ctx).landAfterLogin` — a pending
|
|
170
|
+
`LoginStep`, else a landing suspended in `@owlmeans/client-flow`
|
|
171
|
+
(`flowLandingOf(ctx).resumeSuspendedFlow`, one-shot, an entrypoint alias plus its query — parked
|
|
172
|
+
by a flow's `.suspendFlow` or by `useLogin(target)`), else `HOME` — read BEFORE `alias` is
|
|
173
|
+
defaulted to `HOME`. Login plugins that navigate on their own do the same — see `login-plugins`.
|
|
174
|
+
- A control that leads to a screen through sign-in is `useLogin(target)`. Never navigate to a guarded
|
|
175
|
+
screen to start a sign-in, and never hand a plugin a continuation that goes anywhere but the
|
|
176
|
+
dispatcher: the landing is the dispatcher's decision.
|
|
158
177
|
- The browser ends up holding an ordinary OwlMeans bearer token whichever provider issued the
|
|
159
178
|
login. Product authorization stays server-side, in entrypoint gates and handler checks — never in
|
|
160
179
|
client-only state.
|
|
161
180
|
- The organization entity a token names is its `entitySlug`, the renameable public name. Read it
|
|
162
|
-
with `entitySlugOf` from `@owlmeans/auth`; the stable `entityId` never reaches the
|
|
181
|
+
with `authHelper.entitySlugOf` from `@owlmeans/auth`; the stable `entityId` never reaches the
|
|
182
|
+
browser.
|
|
163
183
|
|
|
164
184
|
## Depends On
|
|
165
185
|
|
|
@@ -7,7 +7,7 @@ import { useNavigate } from '@owlmeans/client';
|
|
|
7
7
|
import { DEFAULT_ALIAS as FLOW_SERVICE } from '@owlmeans/client-flow';
|
|
8
8
|
import { FLOW_PLACEHOLDER, OidcAuthStep, STD_OIDC_FLOW } from '@owlmeans/flow';
|
|
9
9
|
import { SERVICE_PARAM } from '@owlmeans/web-flow';
|
|
10
|
-
import {
|
|
10
|
+
import { loginLandingOf } from '../../login/land.js';
|
|
11
11
|
import { logger } from '@owlmeans/log';
|
|
12
12
|
const log = logger('client-auth:dispatcher');
|
|
13
13
|
export const DispatcherHOC = Renderer => ({ context, params, alias, query, payload }) => {
|
|
@@ -21,7 +21,7 @@ export const DispatcherHOC = Renderer => ({ context, params, alias, query, paylo
|
|
|
21
21
|
// post-sign-in landing decision (steps, landing hooks, the suspended flow, then HOME) and
|
|
22
22
|
// takes priority over the ordinary HOME landing, resolved BEFORE `alias` is overwritten,
|
|
23
23
|
// because once it is `HOME` there is no way back to tell the cases apart.
|
|
24
|
-
const landing = await
|
|
24
|
+
const landing = await loginLandingOf(context).landAfterLogin();
|
|
25
25
|
if (landing.alias !== HOME) {
|
|
26
26
|
await navigator.navigate(context.entrypoint(landing.alias), { params: landing.params, query: landing.query });
|
|
27
27
|
return;
|
|
@@ -36,7 +36,7 @@ export const DispatcherHOC = Renderer => ({ context, params, alias, query, paylo
|
|
|
36
36
|
if (query != null && AUTH_QUERY in query) {
|
|
37
37
|
delete query[AUTH_QUERY];
|
|
38
38
|
}
|
|
39
|
-
const landing = await landAfterLogin(
|
|
39
|
+
const landing = await loginLandingOf(context).landAfterLogin({ fallback: { alias, params, query }, resume: false });
|
|
40
40
|
await navigator.navigate(context.entrypoint(landing.alias), { params: landing.params, query: landing.query });
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/components/dispatcher/component.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAExD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEvD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAoB,aAAa,IAAI,YAAY,EAAE,MAAM,uBAAuB,C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AC,SAAS,EAAE,IAAI,CAAC,CAAA;wBAC7C,CAAC;oBACH,CAAC;oBACD,MAAM,IAAI,CAAC,OAAO,EAAE,CAAA;gBACtB,CAAC,CAAC,CAAA;YACJ,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAc,aAAa,CAAC,CAAA;gBACxD,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE;oBAClD,OAAO,MAAM,QAAQ,EAAE,CAAA;gBACzB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAQ,EAAE,EAAE;oBACpB,oCAAoC;oBACpC,GAAG,CAAC,KAAK,CAAC,uBAAuB,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAA;gBAClE,CAAC,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;IACH,CAAC,EAAE,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAA;IAEvB,MAAM,YAAY,GAAG,WAAW,CAA0C,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QACzF,aAAa,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;IACjC,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,KAAC,QAAQ,IAAC,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAA;AACrE,CAAC,CAAA"}
|
package/build/entrypoints.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** Browser entrypoints for the authentication protocols every client may call. */
|
|
2
|
-
export declare const entrypoints: import("@owlmeans/client-entrypoint").ClientProtocolEntrypoint<
|
|
2
|
+
export declare const entrypoints: import("@owlmeans/client-entrypoint").ClientProtocolEntrypoint<import("@owlmeans/entrypoint").EntrypointProtocol<{
|
|
3
|
+
body: import("@owlmeans/auth").AuthToken;
|
|
4
|
+
}, import("@owlmeans/auth").AuthToken>>[];
|
|
3
5
|
/** Bind the external-authentication screen to one explicitly selected service. */
|
|
4
|
-
export declare const bindExternalAuthentication: (service: string) => import("@owlmeans/client-entrypoint").ClientProtocolEntrypoint<
|
|
6
|
+
export declare const bindExternalAuthentication: (service: string) => import("@owlmeans/client-entrypoint").ClientProtocolEntrypoint<import("@owlmeans/entrypoint").EntrypointProtocol<import("@owlmeans/entrypoint").OpenRequest, import("@owlmeans/entrypoint").OpenValue>>;
|
|
5
7
|
//# sourceMappingURL=entrypoints.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entrypoints.d.ts","sourceRoot":"","sources":["../src/entrypoints.ts"],"names":[],"mappings":"AAIA,kFAAkF;AAClF,eAAO,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"entrypoints.d.ts","sourceRoot":"","sources":["../src/entrypoints.ts"],"names":[],"mappings":"AAIA,kFAAkF;AAClF,eAAO,MAAM,WAAW;;yCAA+C,CAAA;AAEvE,kFAAkF;AAClF,eAAO,MAAM,0BAA0B,YAAa,MAAM,4MAC+B,CAAA"}
|
package/build/helper.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAEnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAa3D,eAAO,MAAM,KAAK,WACR,MAAM,GAAG,gBAAgB,CAAC,GAAG,CAAC,aAAa,OAAO,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,YAAY,SAAS,iDAiDtG,CAAA;AAED,eAAO,MAAM,WAAW,WAAW,OAAO,YAoBzC,CAAA"}
|
package/build/helper.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useContext, useNavigate } from '@owlmeans/client';
|
|
2
|
-
import { provideRequest } from '@owlmeans/client-entrypoint';
|
|
3
2
|
import { useWs as useWebSocket } from '@owlmeans/client-socket';
|
|
4
3
|
import { useEffect, useMemo, useState } from 'react';
|
|
5
4
|
import { AUTH_QUERY, DISPATCHER } from '@owlmeans/auth';
|
|
6
5
|
import { logger } from '@owlmeans/log';
|
|
6
|
+
import { clientRequestHelper } from '@owlmeans/client-entrypoint';
|
|
7
7
|
const log = logger('client-auth');
|
|
8
8
|
// import { useFlow } from '@owlmeans/web-flow'
|
|
9
9
|
// import { DEFAULT_ENTITY } from './consts.js'
|
|
@@ -16,7 +16,7 @@ export const useWs = (module, _request, options) => {
|
|
|
16
16
|
const callerSuppliedToken = _request?.query?.[AUTH_QUERY] != null;
|
|
17
17
|
const request = useMemo(() => {
|
|
18
18
|
if (_request == null) {
|
|
19
|
-
_request = provideRequest(mod.alias, mod.path());
|
|
19
|
+
_request = clientRequestHelper.provideRequest(mod.alias, mod.path());
|
|
20
20
|
}
|
|
21
21
|
try {
|
|
22
22
|
if (_request?.query?.[AUTH_QUERY] == null) {
|
package/build/helper.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE1D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE1D,OAAO,EAAE,KAAK,IAAI,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAI/D,OAAO,EA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;IAEzB,SAAS,CAAC,GAAG,EAAE;QACb,2BAA2B;QAC3B,OAAO,CAAC,IAAI,EAAE,CAAC,aAAa,EAAE,CAAC,IAAI,CAAC,KAAK,EAAC,IAAI,EAAC,EAAE;YAC/C,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;gBACnB,GAAG,CAAC,EAAE,CAAC,UAAU,CAAC,CAAA;gBAClB,6BAA6B;gBAC7B,qEAAqE;YACvE,CAAC;YAED,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;QAC1B,CAAC,CAAC,CAAA;IACJ,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,aAAa,CAAA;AACtB,CAAC,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** The two paths a context's authentication changes by: a token adopted, a token dropped. */
|
|
2
|
+
export interface LoginTokenHelper {
|
|
3
|
+
/**
|
|
4
|
+
* The one path an issued bearer token becomes this context's authentication.
|
|
5
|
+
*
|
|
6
|
+
* Resolved by alias rather than through `ctx.auth()` so the login host does not require
|
|
7
|
+
* `AuthServiceAppend` on the context it is given — a plugin can adopt a token on any context that
|
|
8
|
+
* carries the auth service, including one it did not build.
|
|
9
|
+
*
|
|
10
|
+
* Going through `AuthService.update` matters: it stores the record, decodes the envelope and sets
|
|
11
|
+
* both `auth` and `token` in one place. Writing those three by hand — which is what the popup and
|
|
12
|
+
* the MUI relying party each used to do — leaves the same state on a good day and diverges the
|
|
13
|
+
* moment any of it changes.
|
|
14
|
+
*/
|
|
15
|
+
adoptToken: (token: string) => Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* The one path this context's authentication is dropped, and the exact mirror of {@link adoptToken}.
|
|
18
|
+
*
|
|
19
|
+
* `undefined`, not `null`: `undefined` is the declared clearing value, and on the web the auth
|
|
20
|
+
* service reacts to it by navigating to the dispatcher. Everything that signs a user out goes
|
|
21
|
+
* through here — the hook, both browser plugins and the surrogate screen — so there is one place
|
|
22
|
+
* where "signed out" is defined rather than four that agree until one of them changes.
|
|
23
|
+
*/
|
|
24
|
+
revokeToken: () => Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/login/adopt/types.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;;;;;OAWG;IACH,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5C;;;;;;;OAOG;IACH,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CACjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/login/adopt/types.ts"],"names":[],"mappings":""}
|
package/build/login/adopt.d.ts
CHANGED
|
@@ -1,24 +1,10 @@
|
|
|
1
1
|
import type { LoginContext } from './types.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* carries the auth service, including one it did not build.
|
|
8
|
-
*
|
|
9
|
-
* Going through `AuthService.update` matters: it stores the record, decodes the envelope and sets
|
|
10
|
-
* both `auth` and `token` in one place. Writing those three by hand — which is what the popup and
|
|
11
|
-
* the MUI relying party each used to do — leaves the same state on a good day and diverges the
|
|
12
|
-
* moment any of it changes.
|
|
13
|
-
*/
|
|
2
|
+
import type { LoginTokenHelper } from './adopt/types.js';
|
|
3
|
+
export declare const makeLoginTokenHelper: (ctx: LoginContext) => LoginTokenHelper;
|
|
4
|
+
/** The token helper of a context — one per context. */
|
|
5
|
+
export declare const loginTokenOf: (target: LoginContext) => LoginTokenHelper;
|
|
6
|
+
/** @deprecated compat:factory-refactor — use `loginTokenOf(ctx).adoptToken(…)` */
|
|
14
7
|
export declare const adoptToken: (ctx: LoginContext, token: string) => Promise<void>;
|
|
15
|
-
/**
|
|
16
|
-
* The one path this context's authentication is dropped, and the exact mirror of {@link adoptToken}.
|
|
17
|
-
*
|
|
18
|
-
* `undefined`, not `null`: `undefined` is the declared clearing value, and on the web the auth
|
|
19
|
-
* service reacts to it by navigating to the dispatcher. Everything that signs a user out goes
|
|
20
|
-
* through here — the hook, both browser plugins and the surrogate screen — so there is one place
|
|
21
|
-
* where "signed out" is defined rather than four that agree until one of them changes.
|
|
22
|
-
*/
|
|
8
|
+
/** @deprecated compat:factory-refactor — use `loginTokenOf(ctx).revokeToken()` */
|
|
23
9
|
export declare const revokeToken: (ctx: LoginContext) => Promise<void>;
|
|
24
10
|
//# sourceMappingURL=adopt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adopt.d.ts","sourceRoot":"","sources":["../../src/login/adopt.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"adopt.d.ts","sourceRoot":"","sources":["../../src/login/adopt.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAExD,eAAO,MAAM,oBAAoB,QAAS,YAAY,KAAG,gBAUxD,CAAA;AAED,uDAAuD;AACvD,eAAO,MAAM,YAAY,4CAA2C,CAAA;AAEpE,kFAAkF;AAClF,eAAO,MAAM,UAAU,QAAe,YAAY,SAAS,MAAM,KAAG,OAAO,CAAC,IAAI,CAAwC,CAAA;AAExH,kFAAkF;AAClF,eAAO,MAAM,WAAW,QAAe,YAAY,KAAG,OAAO,CAAC,IAAI,CAAoC,CAAA"}
|
package/build/login/adopt.js
CHANGED
|
@@ -1,28 +1,18 @@
|
|
|
1
|
+
import { memoHelper } from '@owlmeans/context';
|
|
1
2
|
import { DEFAULT_ALIAS as AUTH_ALIAS } from '../consts.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* both `auth` and `token` in one place. Writing those three by hand — which is what the popup and
|
|
11
|
-
* the MUI relying party each used to do — leaves the same state on a good day and diverges the
|
|
12
|
-
* moment any of it changes.
|
|
13
|
-
*/
|
|
14
|
-
export const adoptToken = async (ctx, token) => {
|
|
15
|
-
await ctx.service(AUTH_ALIAS).update(token);
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* The one path this context's authentication is dropped, and the exact mirror of {@link adoptToken}.
|
|
19
|
-
*
|
|
20
|
-
* `undefined`, not `null`: `undefined` is the declared clearing value, and on the web the auth
|
|
21
|
-
* service reacts to it by navigating to the dispatcher. Everything that signs a user out goes
|
|
22
|
-
* through here — the hook, both browser plugins and the surrogate screen — so there is one place
|
|
23
|
-
* where "signed out" is defined rather than four that agree until one of them changes.
|
|
24
|
-
*/
|
|
25
|
-
export const revokeToken = async (ctx) => {
|
|
26
|
-
await ctx.service(AUTH_ALIAS).update(undefined);
|
|
3
|
+
export const makeLoginTokenHelper = (ctx) => {
|
|
4
|
+
const adoptToken = async (token) => {
|
|
5
|
+
await ctx.service(AUTH_ALIAS).update(token);
|
|
6
|
+
};
|
|
7
|
+
const revokeToken = async () => {
|
|
8
|
+
await ctx.service(AUTH_ALIAS).update(undefined);
|
|
9
|
+
};
|
|
10
|
+
return { adoptToken, revokeToken };
|
|
27
11
|
};
|
|
12
|
+
/** The token helper of a context — one per context. */
|
|
13
|
+
export const loginTokenOf = memoHelper.oncePer(makeLoginTokenHelper);
|
|
14
|
+
/** @deprecated compat:factory-refactor — use `loginTokenOf(ctx).adoptToken(…)` */
|
|
15
|
+
export const adoptToken = async (ctx, token) => loginTokenOf(ctx).adoptToken(token);
|
|
16
|
+
/** @deprecated compat:factory-refactor — use `loginTokenOf(ctx).revokeToken()` */
|
|
17
|
+
export const revokeToken = async (ctx) => loginTokenOf(ctx).revokeToken();
|
|
28
18
|
//# sourceMappingURL=adopt.js.map
|
package/build/login/adopt.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adopt.js","sourceRoot":"","sources":["../../src/login/adopt.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,IAAI,UAAU,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"adopt.js","sourceRoot":"","sources":["../../src/login/adopt.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,aAAa,IAAI,UAAU,EAAE,MAAM,cAAc,CAAA;AAI1D,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,GAAiB,EAAoB,EAAE;IAC1E,MAAM,UAAU,GAAG,KAAK,EAAE,KAAa,EAAiB,EAAE;QACxD,MAAM,GAAG,CAAC,OAAO,CAAc,UAAU,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAC1D,CAAC,CAAA;IAED,MAAM,WAAW,GAAG,KAAK,IAAmB,EAAE;QAC5C,MAAM,GAAG,CAAC,OAAO,CAAc,UAAU,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;IAC9D,CAAC,CAAA;IAED,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,CAAA;AACpC,CAAC,CAAA;AAED,uDAAuD;AACvD,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAA;AAEpE,kFAAkF;AAClF,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,EAAE,GAAiB,EAAE,KAAa,EAAiB,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;AAExH,kFAAkF;AAClF,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAAE,GAAiB,EAAiB,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAA"}
|
package/build/login/consts.d.ts
CHANGED
|
@@ -94,4 +94,10 @@ export declare enum LoginIntent {
|
|
|
94
94
|
Login = "login",
|
|
95
95
|
Logout = "logout"
|
|
96
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* How long a sign-in aimed at a screen (`LoginRequest.target`) keeps that screen parked: long
|
|
99
|
+
* enough for a sign-in with an emailed code, short enough that a tab abandoned mid-way never lands
|
|
100
|
+
* a later, unrelated sign-in on it.
|
|
101
|
+
*/
|
|
102
|
+
export declare const LOGIN_TARGET_TTL: number;
|
|
97
103
|
//# sourceMappingURL=consts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../src/login/consts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,kBAAkB,CAAA;AAE5C,eAAO,MAAM,aAAa,kBAAgB,CAAA;AAE1C,sEAAsE;AACtE,eAAO,MAAM,sBAAsB,IAAI,CAAA;AAEvC,kDAAkD;AAClD,eAAO,MAAM,oBAAoB,MAAM,CAAA;AAEvC;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,wBAAwB,CAAA;AAEzD,eAAO,MAAM,mBAAmB,8BAA8B,CAAA;AAE9D,eAAO,MAAM,oBAAoB,+BAA+B,CAAA;AAEhE,eAAO,MAAM,sBAAsB,yBAAyB,CAAA;AAE5D,eAAO,MAAM,qBAAqB,MAAM,CAAA;AAExC,eAAO,MAAM,sBAAsB,MAAM,CAAA;AAEzC;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,mCACwC,CAAA;AAE7E,kFAAkF;AAClF,eAAO,MAAM,oBAAoB,MAAM,CAAA;AAEvC,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB,WAAW,CAAA;AAE1C;;;GAGG;AACH,eAAO,MAAM,gBAAgB,SAAS,CAAA;AAEtC;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,WAAW,CAAA;AAE1C,kFAAkF;AAClF,eAAO,MAAM,mBAAmB,0BAA0B,CAAA;A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MAAM,CAAA;AAEvC,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB,WAAW,CAAA;AAE1C;;;GAGG;AACH,eAAO,MAAM,gBAAgB,SAAS,CAAA;AAEtC;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,WAAW,CAAA;AAE1C,kFAAkF;AAClF,eAAO,MAAM,mBAAmB,0BAA0B,CAAA;AAE1D;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,OAAQ,CAAA;AAEvC,iFAAiF;AACjF,eAAO,MAAM,oBAAoB,2BAA2B,CAAA;AAE5D,sEAAsE;AACtE,oBAAY,YAAY;IACtB,kFAAkF;IAClF,IAAI,SAAS;IACb,oFAAoF;IACpF,MAAM,WAAW;IACjB,sEAAsE;IACtE,QAAQ,aAAa;CACtB;AAED,oEAAoE;AACpE,oBAAY,YAAY;IACtB,sFAAsF;IACtF,OAAO,YAAY;IACnB,qFAAqF;IACrF,MAAM,WAAW;IACjB,oFAAoF;IACpF,UAAU,eAAe;IACzB,0FAA0F;IAC1F,OAAO,YAAY;IACnB,6EAA6E;IAC7E,QAAQ,aAAa;IACrB,gGAAgG;IAChG,MAAM,WAAW;IACjB;;;;;;OAMG;IACH,OAAO,YAAY;CACpB;AAED,yCAAyC;AACzC,oBAAY,WAAW;IACrB,KAAK,UAAU;IACf,MAAM,WAAW;CAClB;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,QAAiB,CAAA"}
|
package/build/login/consts.js
CHANGED
|
@@ -97,4 +97,10 @@ export var LoginIntent;
|
|
|
97
97
|
LoginIntent["Login"] = "login";
|
|
98
98
|
LoginIntent["Logout"] = "logout";
|
|
99
99
|
})(LoginIntent || (LoginIntent = {}));
|
|
100
|
+
/**
|
|
101
|
+
* How long a sign-in aimed at a screen (`LoginRequest.target`) keeps that screen parked: long
|
|
102
|
+
* enough for a sign-in with an emailed code, short enough that a tab abandoned mid-way never lands
|
|
103
|
+
* a later, unrelated sign-in on it.
|
|
104
|
+
*/
|
|
105
|
+
export const LOGIN_TARGET_TTL = 30 * 60 * 1000;
|
|
100
106
|
//# sourceMappingURL=consts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../../src/login/consts.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAA;AAE5C,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAA;AAE1C,sEAAsE;AACtE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAA;AAEvC,kDAAkD;AAClD,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAA;AAEvC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,qBAAqB,CAAA;AAEzD,MAAM,CAAC,MAAM,mBAAmB,GAAG,2BAA2B,CAAA;AAE9D,MAAM,CAAC,MAAM,oBAAoB,GAAG,4BAA4B,CAAA;AAEhE,MAAM,CAAC,MAAM,sBAAsB,GAAG,sBAAsB,CAAA;AAE5D,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAA;AAExC,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAA;AAEzC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,wBAAwB,GACnC,mBAAmB,qBAAqB,WAAW,sBAAsB,EAAE,CAAA;AAE7E,kFAAkF;AAClF,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAA;AAEvC,8EAA8E;AAC9E,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAA;AAE1C;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAA;AAEtC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAA;AAE1C,kFAAkF;AAClF,MAAM,CAAC,MAAM,mBAAmB,GAAG,uBAAuB,CAAA;AAE1D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,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ACrB,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;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LoginOutcome } from './consts.js';
|
|
1
2
|
import type { CSSProperties } from 'react';
|
|
2
3
|
/**
|
|
3
4
|
* The page the card sits in.
|
|
@@ -10,4 +11,6 @@ export declare const page: CSSProperties;
|
|
|
10
11
|
export declare const box: CSSProperties;
|
|
11
12
|
/** The same English fallback a document's `i18nKey` translates to when nothing else names it. */
|
|
12
13
|
export declare const DEFAULT_LABEL: Record<string, string>;
|
|
14
|
+
/** Outcomes after which nobody was signed in, so a screen parked for the landing must not wait. */
|
|
15
|
+
export declare const UNSIGNED_OUTCOMES: ReadonlySet<LoginOutcome>;
|
|
13
16
|
//# sourceMappingURL=consts.local.d.ts.map
|