@owlmeans/client-auth 0.1.18-rc.22 → 0.1.18-rc.23
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 +5 -3
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/client-auth/SKILL.md +3 -3
- package/build/entrypoints.d.ts +6 -3
- package/build/entrypoints.d.ts.map +1 -1
- package/build/entrypoints.js +6 -8
- package/build/entrypoints.js.map +1 -1
- package/build/login/consts.d.ts +0 -18
- package/build/login/consts.d.ts.map +1 -1
- package/build/login/consts.js +0 -18
- package/build/login/consts.js.map +1 -1
- package/build/manager/entrypoints.d.ts +10 -1
- package/build/manager/entrypoints.d.ts.map +1 -1
- package/build/manager/entrypoints.js +14 -13
- package/build/manager/entrypoints.js.map +1 -1
- package/package.json +22 -22
- package/src/entrypoints.ts +7 -10
- package/src/login/consts.ts +0 -19
- package/src/manager/README.md +36 -79
- package/src/manager/entrypoints.ts +14 -14
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Client-side authentication service providing user auth state and external auth f
|
|
|
6
6
|
|
|
7
7
|
- `useSelfAuth()` — React hook that returns the current authenticated user's `Auth` object
|
|
8
8
|
- `setupExternalAuthentication()` — configure the client to authenticate against an external identity provider
|
|
9
|
-
- `entrypoints` — pre-built
|
|
9
|
+
- `entrypoints` — pre-built bindings for the auth protocols (login, dispatcher)
|
|
10
10
|
- `DEFAULT_ALIAS` — the auth service alias (`'auth'`)
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
@@ -49,7 +49,9 @@ Configures the context to redirect to an external identity provider for authenti
|
|
|
49
49
|
|
|
50
50
|
### `entrypoints`
|
|
51
51
|
|
|
52
|
-
Pre-built
|
|
52
|
+
Pre-built protocol bindings for the auth flow (mirrors `@owlmeans/auth-common`'s declarations with
|
|
53
|
+
client route models). New application code should resolve its shared protocol with
|
|
54
|
+
`context.entrypoint(protocol)` rather than supplying a caller-side type.
|
|
53
55
|
|
|
54
56
|
### `DEFAULT_ALIAS`
|
|
55
57
|
|
|
@@ -76,7 +78,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
|
|
|
76
78
|
your project's skill store (`.agents/skills/`):
|
|
77
79
|
|
|
78
80
|
```sh
|
|
79
|
-
npx @owlmeans/agent-skills@^0.1.18-rc.
|
|
81
|
+
npx @owlmeans/agent-skills@^0.1.18-rc.15
|
|
80
82
|
```
|
|
81
83
|
|
|
82
84
|
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-09-
|
|
4
|
+
"version": "0.1.18-rc.23",
|
|
5
|
+
"generatedAt": "2026-09-12T08:39:52.713Z",
|
|
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.23"` in `dependencies`
|
|
12
12
|
|
|
13
13
|
Five subpaths, five jobs:
|
|
14
14
|
|
|
@@ -16,7 +16,7 @@ Five subpaths, five jobs:
|
|
|
16
16
|
|---------|-----|
|
|
17
17
|
| `.` | The client `AuthService`, the shared auth entrypoints, and the dispatcher HOC |
|
|
18
18
|
| `./manager` | The registry's four names plus the authentication screen, control and error — *how* a user proves identity. Importing it registers the three shipped browser plugins and `pluginMethodSource` by side effect |
|
|
19
|
-
| `./manager/entrypoints` | The manager application's own front-end entrypoint
|
|
19
|
+
| `./manager/entrypoints` | The manager application's own front-end entrypoint bindings |
|
|
20
20
|
| `./manager/plugins` | The plugin-authoring surface, and a superset of the registry: the `AuthenticationPlugin` contract, `pluginMethodSource`, the wallet-tunnel helpers and the shipped plugin objects — with no registration side effect |
|
|
21
21
|
| `./login` | The **login**-plugin host — *where* the authorization round trip runs, and which method a person picks |
|
|
22
22
|
|
|
@@ -37,7 +37,7 @@ conflate them.
|
|
|
37
37
|
| `makeAuthService(alias?)` | The client `AuthService` — `authenticate(token)`, `update(token)`, `authenticated()`, `user()`, `store()`. Decodes the bearer envelope and persists the record |
|
|
38
38
|
| `appendAuthService(ctx, alias?)` | Register it, register `authMiddleware`, and expose `context.auth()` |
|
|
39
39
|
| `setupExternalAuthentication(service)` | Point the `CAUTHEN_FLOW_ENTER` entrypoint at a service, so an external provider can redirect into this app |
|
|
40
|
-
| `entrypoints` | The shared auth entrypoint list with `DISPATCHER_AUTHEN`
|
|
40
|
+
| `entrypoints` | The shared auth entrypoint list with `DISPATCHER_AUTHEN` bound |
|
|
41
41
|
| `DEFAULT_ALIAS` | `'auth'` — the client-side counterpart of `DEFAULT_GUARD` |
|
|
42
42
|
| `AUTH_RESOURCE` | `'auth'` — the resource the token record is stored in |
|
|
43
43
|
| `USER_ID` | `'user'` — the id of that single record |
|
package/build/entrypoints.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const entrypoints:
|
|
3
|
-
|
|
1
|
+
/** Browser entrypoints for the authentication protocols every client may call. */
|
|
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>>[];
|
|
5
|
+
/** Bind the external-authentication screen to one explicitly selected service. */
|
|
6
|
+
export declare const bindExternalAuthentication: (service: string) => import("@owlmeans/client-entrypoint").ClientProtocolEntrypoint<import("@owlmeans/entrypoint").EntrypointProtocol<import("@owlmeans/entrypoint").OpenRequest, import("@owlmeans/entrypoint").OpenValue>>;
|
|
4
7
|
//# sourceMappingURL=entrypoints.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entrypoints.d.ts","sourceRoot":"","sources":["../src/entrypoints.ts"],"names":[],"mappings":"AAIA,
|
|
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/entrypoints.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export const
|
|
7
|
-
elevate(list, CAUTHEN_FLOW_ENTER, stab, { routeOptions: { overrides: { service } } });
|
|
8
|
-
};
|
|
1
|
+
import { bind, bindScreen, stab } from '@owlmeans/client-entrypoint';
|
|
2
|
+
import { authProtocols } from '@owlmeans/auth-common';
|
|
3
|
+
/** Browser entrypoints for the authentication protocols every client may call. */
|
|
4
|
+
export const entrypoints = [bind(authProtocols.dispatcherAuthenticate)];
|
|
5
|
+
/** Bind the external-authentication screen to one explicitly selected service. */
|
|
6
|
+
export const bindExternalAuthentication = (service) => bindScreen(authProtocols.flowEnter, stab, { routeOptions: { overrides: { service } } });
|
|
9
7
|
//# sourceMappingURL=entrypoints.js.map
|
package/build/entrypoints.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entrypoints.js","sourceRoot":"","sources":["../src/entrypoints.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"entrypoints.js","sourceRoot":"","sources":["../src/entrypoints.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAErD,kFAAkF;AAClF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,sBAAsB,CAAC,CAAC,CAAA;AAEvE,kFAAkF;AAClF,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,OAAe,EAAE,EAAE,CAC5D,UAAU,CAAC,aAAa,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAA"}
|
package/build/login/consts.d.ts
CHANGED
|
@@ -34,24 +34,6 @@ export declare const LOGIN_NEXT_QUERY = "next";
|
|
|
34
34
|
* choice was made, by a person, in the document that opened this one.
|
|
35
35
|
*/
|
|
36
36
|
export declare const LOGIN_METHOD_QUERY = "method";
|
|
37
|
-
/**
|
|
38
|
-
* Says that this window was opened to PRODUCE a session, not to find one.
|
|
39
|
-
*
|
|
40
|
-
* A surrogate window runs on the application's own origin, so it can see a session the application
|
|
41
|
-
* left there earlier — and a session that is merely present is not a session that still works. The
|
|
42
|
-
* document holding it has no way to tell: `authenticated()` reads storage and decodes an envelope,
|
|
43
|
-
* and nothing in the client asks the server whether the record behind it is still there. So a
|
|
44
|
-
* revoked, replaced or expired token was handed straight back to the window that asked for a
|
|
45
|
-
* login, which adopted it, failed every call it made with it, and asked again — the same dead
|
|
46
|
-
* token, every time, for as long as the browser kept it. Clearing site data was the only exit,
|
|
47
|
-
* which is exactly how the defect was reported.
|
|
48
|
-
*
|
|
49
|
-
* With this set, the surrogate and the dispatcher both skip the resume and run the authorization
|
|
50
|
-
* flow. That is not the expensive path it sounds like: the provider's own session normally answers
|
|
51
|
-
* the request without asking the person anything, and what comes back is a token the provider has
|
|
52
|
-
* just vouched for. It is also what makes signing in as somebody else possible at all.
|
|
53
|
-
*/
|
|
54
|
-
export declare const LOGIN_FRESH_QUERY = "fresh";
|
|
55
37
|
/** Where a browser records that it agreed to one exact set of legal documents. */
|
|
56
38
|
export declare const LOGIN_TERMS_STORAGE = "_owlmeans-login-terms";
|
|
57
39
|
//# 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,wBAAwB,mCAAmC,CAAA;AAExE,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
|
|
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,wBAAwB,mCAAmC,CAAA;AAExE,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"}
|
package/build/login/consts.js
CHANGED
|
@@ -34,24 +34,6 @@ export const LOGIN_NEXT_QUERY = 'next';
|
|
|
34
34
|
* choice was made, by a person, in the document that opened this one.
|
|
35
35
|
*/
|
|
36
36
|
export const LOGIN_METHOD_QUERY = 'method';
|
|
37
|
-
/**
|
|
38
|
-
* Says that this window was opened to PRODUCE a session, not to find one.
|
|
39
|
-
*
|
|
40
|
-
* A surrogate window runs on the application's own origin, so it can see a session the application
|
|
41
|
-
* left there earlier — and a session that is merely present is not a session that still works. The
|
|
42
|
-
* document holding it has no way to tell: `authenticated()` reads storage and decodes an envelope,
|
|
43
|
-
* and nothing in the client asks the server whether the record behind it is still there. So a
|
|
44
|
-
* revoked, replaced or expired token was handed straight back to the window that asked for a
|
|
45
|
-
* login, which adopted it, failed every call it made with it, and asked again — the same dead
|
|
46
|
-
* token, every time, for as long as the browser kept it. Clearing site data was the only exit,
|
|
47
|
-
* which is exactly how the defect was reported.
|
|
48
|
-
*
|
|
49
|
-
* With this set, the surrogate and the dispatcher both skip the resume and run the authorization
|
|
50
|
-
* flow. That is not the expensive path it sounds like: the provider's own session normally answers
|
|
51
|
-
* the request without asking the person anything, and what comes back is a token the provider has
|
|
52
|
-
* just vouched for. It is also what makes signing in as somebody else possible at all.
|
|
53
|
-
*/
|
|
54
|
-
export const LOGIN_FRESH_QUERY = 'fresh';
|
|
55
37
|
/** Where a browser records that it agreed to one exact set of legal documents. */
|
|
56
38
|
export const LOGIN_TERMS_STORAGE = '_owlmeans-login-terms';
|
|
57
39
|
//# 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,wBAAwB,GAAG,gCAAgC,CAAA;AAExE,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
|
|
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,wBAAwB,GAAG,gCAAgC,CAAA;AAExE,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"}
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
|
|
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>>)[];
|
|
2
11
|
//# sourceMappingURL=entrypoints.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entrypoints.d.ts","sourceRoot":"","sources":["../../src/manager/entrypoints.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"entrypoints.d.ts","sourceRoot":"","sources":["../../src/manager/entrypoints.ts"],"names":[],"mappings":"AAMA,kEAAkE;AAClE,eAAO,MAAM,WAAW;;;;;;;;iBAUvB,CAAA"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { entrypoints as list } from '@owlmeans/auth-common';
|
|
1
|
+
import { authProtocols } from '@owlmeans/auth-common';
|
|
3
2
|
import { handler } from '@owlmeans/client';
|
|
4
|
-
import {
|
|
3
|
+
import { bind, bindScreen, stab } from '@owlmeans/client-entrypoint';
|
|
5
4
|
import { AuthenticationHOC } from './components/authentication/component.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
+
];
|
|
16
17
|
//# sourceMappingURL=entrypoints.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entrypoints.js","sourceRoot":"","sources":["../../src/manager/entrypoints.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlmeans/client-auth",
|
|
3
|
-
"version": "0.1.18-rc.
|
|
3
|
+
"version": "0.1.18-rc.23",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -50,26 +50,26 @@
|
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@owlmeans/auth": "^0.1.18-rc.
|
|
54
|
-
"@owlmeans/auth-common": "^0.1.18-rc.
|
|
55
|
-
"@owlmeans/basic-envelope": "^0.1.18-rc.
|
|
56
|
-
"@owlmeans/basic-keys": "^0.1.18-rc.
|
|
57
|
-
"@owlmeans/client": "^0.1.18-rc.
|
|
58
|
-
"@owlmeans/client-context": "^0.1.18-rc.
|
|
59
|
-
"@owlmeans/client-entrypoint": "^0.1.18-rc.
|
|
60
|
-
"@owlmeans/client-flow": "^0.1.18-rc.
|
|
61
|
-
"@owlmeans/client-resource": "^0.1.18-rc.
|
|
62
|
-
"@owlmeans/client-socket": "^0.1.18-rc.
|
|
63
|
-
"@owlmeans/config": "^0.1.18-rc.
|
|
64
|
-
"@owlmeans/context": "^0.1.18-rc.
|
|
65
|
-
"@owlmeans/did": "^0.1.18-rc.
|
|
66
|
-
"@owlmeans/entrypoint": "^0.1.18-rc.
|
|
67
|
-
"@owlmeans/error": "^0.1.18-rc.
|
|
68
|
-
"@owlmeans/flow": "^0.1.18-rc.
|
|
69
|
-
"@owlmeans/i18n": "^0.1.18-rc.
|
|
70
|
-
"@owlmeans/resource": "^0.1.18-rc.
|
|
71
|
-
"@owlmeans/socket": "^0.1.18-rc.
|
|
72
|
-
"@owlmeans/web-flow": "^0.1.18-rc.
|
|
53
|
+
"@owlmeans/auth": "^0.1.18-rc.12",
|
|
54
|
+
"@owlmeans/auth-common": "^0.1.18-rc.16",
|
|
55
|
+
"@owlmeans/basic-envelope": "^0.1.18-rc.15",
|
|
56
|
+
"@owlmeans/basic-keys": "^0.1.18-rc.15",
|
|
57
|
+
"@owlmeans/client": "^0.1.18-rc.19",
|
|
58
|
+
"@owlmeans/client-context": "^0.1.18-rc.16",
|
|
59
|
+
"@owlmeans/client-entrypoint": "^0.1.18-rc.16",
|
|
60
|
+
"@owlmeans/client-flow": "^0.1.18-rc.20",
|
|
61
|
+
"@owlmeans/client-resource": "^0.1.18-rc.16",
|
|
62
|
+
"@owlmeans/client-socket": "^0.1.18-rc.17",
|
|
63
|
+
"@owlmeans/config": "^0.1.18-rc.15",
|
|
64
|
+
"@owlmeans/context": "^0.1.18-rc.11",
|
|
65
|
+
"@owlmeans/did": "^0.1.18-rc.15",
|
|
66
|
+
"@owlmeans/entrypoint": "^0.1.18-rc.14",
|
|
67
|
+
"@owlmeans/error": "^0.1.18-rc.11",
|
|
68
|
+
"@owlmeans/flow": "^0.1.18-rc.17",
|
|
69
|
+
"@owlmeans/i18n": "^0.1.18-rc.11",
|
|
70
|
+
"@owlmeans/resource": "^0.1.18-rc.12",
|
|
71
|
+
"@owlmeans/socket": "^0.1.18-rc.12",
|
|
72
|
+
"@owlmeans/web-flow": "^0.1.18-rc.20",
|
|
73
73
|
"@scure/base": "^2.3.0"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@owlmeans/dep-config": "workspace:*",
|
|
81
|
-
"@owlmeans/test-auth": "^0.1.18-rc.
|
|
81
|
+
"@owlmeans/test-auth": "^0.1.18-rc.16",
|
|
82
82
|
"@types/bun": "^1.4.0",
|
|
83
83
|
"@types/react": "^19.2.17",
|
|
84
84
|
"nodemon": "^3.1.14",
|
package/src/entrypoints.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { CAUTHEN_FLOW_ENTER, DISPATCHER_AUTHEN } from '@owlmeans/auth'
|
|
5
|
-
import type { ClientEntrypoint } from '@owlmeans/client-entrypoint'
|
|
2
|
+
import { bind, bindScreen, stab } from '@owlmeans/client-entrypoint'
|
|
3
|
+
import { authProtocols } from '@owlmeans/auth-common'
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
/** Browser entrypoints for the authentication protocols every client may call. */
|
|
6
|
+
export const entrypoints = [bind(authProtocols.dispatcherAuthenticate)]
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
elevate(list, CAUTHEN_FLOW_ENTER, stab, { routeOptions: { overrides: { service } } })
|
|
13
|
-
}
|
|
8
|
+
/** Bind the external-authentication screen to one explicitly selected service. */
|
|
9
|
+
export const bindExternalAuthentication = (service: string) =>
|
|
10
|
+
bindScreen(authProtocols.flowEnter, stab, { routeOptions: { overrides: { service } } })
|
package/src/login/consts.ts
CHANGED
|
@@ -47,24 +47,5 @@ export const LOGIN_NEXT_QUERY = 'next'
|
|
|
47
47
|
*/
|
|
48
48
|
export const LOGIN_METHOD_QUERY = 'method'
|
|
49
49
|
|
|
50
|
-
/**
|
|
51
|
-
* Says that this window was opened to PRODUCE a session, not to find one.
|
|
52
|
-
*
|
|
53
|
-
* A surrogate window runs on the application's own origin, so it can see a session the application
|
|
54
|
-
* left there earlier — and a session that is merely present is not a session that still works. The
|
|
55
|
-
* document holding it has no way to tell: `authenticated()` reads storage and decodes an envelope,
|
|
56
|
-
* and nothing in the client asks the server whether the record behind it is still there. So a
|
|
57
|
-
* revoked, replaced or expired token was handed straight back to the window that asked for a
|
|
58
|
-
* login, which adopted it, failed every call it made with it, and asked again — the same dead
|
|
59
|
-
* token, every time, for as long as the browser kept it. Clearing site data was the only exit,
|
|
60
|
-
* which is exactly how the defect was reported.
|
|
61
|
-
*
|
|
62
|
-
* With this set, the surrogate and the dispatcher both skip the resume and run the authorization
|
|
63
|
-
* flow. That is not the expensive path it sounds like: the provider's own session normally answers
|
|
64
|
-
* the request without asking the person anything, and what comes back is a token the provider has
|
|
65
|
-
* just vouched for. It is also what makes signing in as somebody else possible at all.
|
|
66
|
-
*/
|
|
67
|
-
export const LOGIN_FRESH_QUERY = 'fresh'
|
|
68
|
-
|
|
69
50
|
/** Where a browser records that it agreed to one exact set of legal documents. */
|
|
70
51
|
export const LOGIN_TERMS_STORAGE = '_owlmeans-login-terms'
|
package/src/manager/README.md
CHANGED
|
@@ -21,9 +21,9 @@ React components that handle various authentication scenarios:
|
|
|
21
21
|
- **Tunnel Consumer**: Component for handling WebSocket authentication tunnels
|
|
22
22
|
- **Credential Management**: Secure handling of user credentials
|
|
23
23
|
|
|
24
|
-
###
|
|
25
|
-
The manager integrates with the OwlMeans
|
|
26
|
-
- **
|
|
24
|
+
### Entrypoint Integration
|
|
25
|
+
The manager integrates with the OwlMeans entrypoint system to provide:
|
|
26
|
+
- **Enhanced Entrypoints**: Entrypoints with client-specific authentication handling
|
|
27
27
|
- **Route Protection**: Automatic authentication requirements for protected routes
|
|
28
28
|
- **API Integration**: Seamless integration with authentication APIs
|
|
29
29
|
|
|
@@ -134,37 +134,22 @@ try {
|
|
|
134
134
|
}
|
|
135
135
|
```
|
|
136
136
|
|
|
137
|
-
###
|
|
137
|
+
### Entrypoints
|
|
138
138
|
|
|
139
|
-
#### `
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
```typescript
|
|
143
|
-
const modules: CommonModule[]
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
Contains elevated modules for:
|
|
147
|
-
- `AUTHEN` - Base authentication module
|
|
148
|
-
- `AUTHEN_INIT` - Authentication initialization
|
|
149
|
-
- `AUTHEN_AUTHEN` - User authentication
|
|
150
|
-
- `AUTHEN_RELY` - Authentication relay
|
|
151
|
-
- `CAUTHEN` - Client authentication
|
|
152
|
-
- `CAUTHEN_AUTHEN` - Client authentication handler
|
|
153
|
-
- `CAUTHEN_AUTHEN_DEFAULT` - Default authentication component
|
|
154
|
-
- `CAUTHEN_AUTHEN_TYPED` - Typed authentication component
|
|
155
|
-
- `DISPATCHER` - Authentication dispatcher
|
|
139
|
+
#### `entrypoints`
|
|
140
|
+
The shared, immutable authentication declarations. Bind them into the client context alongside
|
|
141
|
+
the application's own entrypoints.
|
|
156
142
|
|
|
157
143
|
## Usage Examples
|
|
158
144
|
|
|
159
145
|
### Basic Authentication Setup
|
|
160
146
|
|
|
161
147
|
```typescript
|
|
162
|
-
import {
|
|
163
|
-
import {
|
|
148
|
+
import { entrypoints } from '@owlmeans/client-auth/manager'
|
|
149
|
+
import { makeContext } from '@owlmeans/web-client'
|
|
164
150
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
context.registerModules(modules)
|
|
151
|
+
const context = makeContext(config)
|
|
152
|
+
context.registerEntrypoints(entrypoints)
|
|
168
153
|
|
|
169
154
|
await context.configure().init()
|
|
170
155
|
```
|
|
@@ -256,48 +241,27 @@ function RealtimeApp() {
|
|
|
256
241
|
|
|
257
242
|
### Custom Authentication Flow
|
|
258
243
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
import { useModule } from '@owlmeans/client'
|
|
244
|
+
Use the typed authentication protocols from `@owlmeans/auth-common`; the context supplies the
|
|
245
|
+
registered client binding and infers the request and response types from the protocol.
|
|
262
246
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
console.error('Invalid credentials:', error.message)
|
|
281
|
-
} else {
|
|
282
|
-
console.error('Authentication failed:', error)
|
|
283
|
-
}
|
|
284
|
-
}
|
|
247
|
+
```typescript
|
|
248
|
+
import { AuthenticationType } from '@owlmeans/auth'
|
|
249
|
+
import { authProtocols } from '@owlmeans/auth-common'
|
|
250
|
+
import { AuthenCredError } from '@owlmeans/client-auth/manager'
|
|
251
|
+
import type { ClientContext } from '@owlmeans/client-context'
|
|
252
|
+
|
|
253
|
+
async function authenticate(context: ClientContext, credentials: { username: string, password: string }) {
|
|
254
|
+
try {
|
|
255
|
+
const allowance = await context.entrypoint(authProtocols.init).call({
|
|
256
|
+
body: { type: AuthenticationType.PasswordLogin },
|
|
257
|
+
})
|
|
258
|
+
return await context.entrypoint(authProtocols.authenticate).call({
|
|
259
|
+
body: { ...credentials, challenge: allowance.challenge },
|
|
260
|
+
})
|
|
261
|
+
} catch (error) {
|
|
262
|
+
if (error instanceof AuthenCredError) console.error('Invalid credentials:', error.message)
|
|
263
|
+
throw error
|
|
285
264
|
}
|
|
286
|
-
|
|
287
|
-
return (
|
|
288
|
-
<form onSubmit={(e) => {
|
|
289
|
-
e.preventDefault()
|
|
290
|
-
const formData = new FormData(e.target)
|
|
291
|
-
handleLogin({
|
|
292
|
-
username: formData.get('username'),
|
|
293
|
-
password: formData.get('password')
|
|
294
|
-
})
|
|
295
|
-
}}>
|
|
296
|
-
<input name="username" placeholder="Username" required />
|
|
297
|
-
<input name="password" type="password" placeholder="Password" required />
|
|
298
|
-
<button type="submit">Login</button>
|
|
299
|
-
</form>
|
|
300
|
-
)
|
|
301
265
|
}
|
|
302
266
|
```
|
|
303
267
|
|
|
@@ -408,18 +372,11 @@ Single-use token authentication for enhanced security.
|
|
|
408
372
|
5. **Graceful Fallbacks**: Provide fallback UI for authentication failures
|
|
409
373
|
6. **Security**: Never store sensitive credentials in local storage
|
|
410
374
|
|
|
411
|
-
##
|
|
412
|
-
|
|
413
|
-
The manager uses module elevation to enhance base authentication modules:
|
|
414
|
-
|
|
415
|
-
```typescript
|
|
416
|
-
// Base modules are elevated with client-specific handlers
|
|
417
|
-
elevate(list, AUTHEN_INIT, true) // API call elevation
|
|
418
|
-
elevate(list, AUTHEN_AUTHEN, true) // Authentication elevation
|
|
419
|
-
elevate(list, CAUTHEN_AUTHEN_DEFAULT, handler(AuthenticationHOC())) // Component handler
|
|
420
|
-
```
|
|
375
|
+
## Entrypoint wiring
|
|
421
376
|
|
|
422
|
-
|
|
377
|
+
The manager exports a ready-to-use `entrypoints` collection. Compose it with the application's
|
|
378
|
+
own declarations and use `bind`/`bindScreen` from `@owlmeans/client-entrypoint` when adding a
|
|
379
|
+
custom client handler; handlers are attached to declaration objects, never looked up by alias.
|
|
423
380
|
|
|
424
381
|
## Dependencies
|
|
425
382
|
|
|
@@ -427,7 +384,7 @@ This manager depends on:
|
|
|
427
384
|
- `@owlmeans/auth` - Core authentication functionality
|
|
428
385
|
- `@owlmeans/auth-common` - Shared authentication components
|
|
429
386
|
- `@owlmeans/client` - Client-side framework functionality
|
|
430
|
-
- `@owlmeans/client-
|
|
387
|
+
- `@owlmeans/client-entrypoint` - Typed protocol binding system
|
|
431
388
|
- `@owlmeans/error` - Error management system
|
|
432
389
|
- `react` - React framework for UI components
|
|
433
390
|
|
|
@@ -436,4 +393,4 @@ This manager depends on:
|
|
|
436
393
|
- [`@owlmeans/client-auth`](../../../README.md) - Parent client authentication package
|
|
437
394
|
- [`@owlmeans/server-auth/manager`](../../../server-auth/src/manager/README.md) - Server-side authentication manager
|
|
438
395
|
- [`@owlmeans/auth`](../../../auth/README.md) - Core authentication library
|
|
439
|
-
- [`@owlmeans/client`](../../../client/README.md) - Client-side framework
|
|
396
|
+
- [`@owlmeans/client`](../../../client/README.md) - Client-side framework
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import { entrypoints as list } from '@owlmeans/auth-common'
|
|
2
|
+
import { authProtocols } from '@owlmeans/auth-common'
|
|
4
3
|
import { handler } from '@owlmeans/client'
|
|
5
|
-
import {
|
|
4
|
+
import { bind, bindScreen, stab } from '@owlmeans/client-entrypoint'
|
|
6
5
|
import { AuthenticationHOC } from './components/authentication/component.js'
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
/** Browser entrypoints for the manager's authentication flows. */
|
|
8
|
+
export const entrypoints = [
|
|
9
|
+
bind(authProtocols.authen),
|
|
10
|
+
bind(authProtocols.init),
|
|
11
|
+
bind(authProtocols.authenticate),
|
|
12
|
+
bind(authProtocols.rely),
|
|
13
|
+
bind(authProtocols.client),
|
|
14
|
+
bind(authProtocols.login),
|
|
15
|
+
bindScreen(authProtocols.loginDefault, handler(AuthenticationHOC())),
|
|
16
|
+
bindScreen(authProtocols.loginTyped, handler(AuthenticationHOC())),
|
|
17
|
+
bindScreen(authProtocols.dispatcher, stab),
|
|
18
|
+
]
|