@owlmeans/server-auth 0.1.18-rc.20 → 0.1.18-rc.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -2
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/server-auth/SKILL.md +4 -4
- package/build/actions/service.d.ts +6 -2
- package/build/actions/service.d.ts.map +1 -1
- package/build/actions/service.js +5 -4
- package/build/actions/service.js.map +1 -1
- package/build/entrypoints.d.ts +4 -2
- package/build/entrypoints.d.ts.map +1 -1
- package/build/entrypoints.js +5 -7
- package/build/entrypoints.js.map +1 -1
- package/build/manager/actions/manager.d.ts +17 -5
- package/build/manager/actions/manager.d.ts.map +1 -1
- package/build/manager/actions/manager.js +7 -6
- package/build/manager/actions/manager.js.map +1 -1
- package/build/manager/entrypoints.d.ts +8 -1
- package/build/manager/entrypoints.d.ts.map +1 -1
- package/build/manager/entrypoints.js +17 -14
- package/build/manager/entrypoints.js.map +1 -1
- package/build/manager/exports.d.ts +1 -2
- package/build/manager/exports.d.ts.map +1 -1
- package/build/manager/exports.js +1 -2
- package/build/manager/exports.js.map +1 -1
- package/build/model/rely/consumer.d.ts +3 -1
- package/build/model/rely/consumer.d.ts.map +1 -1
- package/build/model/rely/consumer.js.map +1 -1
- package/build/model/rely/provider.d.ts +3 -1
- package/build/model/rely/provider.d.ts.map +1 -1
- package/build/model/rely/provider.js.map +1 -1
- package/package.json +25 -25
- package/src/actions/service.ts +9 -8
- package/src/entrypoints.ts +8 -13
- package/src/manager/README.md +13 -17
- package/src/manager/actions/manager.ts +15 -13
- package/src/manager/entrypoints.ts +20 -23
- package/src/manager/exports.ts +1 -2
- package/src/model/rely/consumer.ts +3 -1
- package/src/model/rely/provider.ts +3 -1
package/README.md
CHANGED
|
@@ -33,9 +33,15 @@ Reference the guard by alias when protecting routes:
|
|
|
33
33
|
|
|
34
34
|
```typescript
|
|
35
35
|
import { DAUTH_GUARD } from '@owlmeans/server-app'
|
|
36
|
+
import { contract, protocol, typed } from '@owlmeans/entrypoint'
|
|
37
|
+
import { route } from '@owlmeans/route'
|
|
36
38
|
// same as DEFAULT_ALIAS from @owlmeans/server-auth
|
|
37
39
|
|
|
38
|
-
const
|
|
40
|
+
const adminProtocol = protocol(
|
|
41
|
+
route('admin', '/admin'),
|
|
42
|
+
contract(typed<AdminResponse>()),
|
|
43
|
+
{ guards: DAUTH_GUARD },
|
|
44
|
+
)
|
|
39
45
|
```
|
|
40
46
|
|
|
41
47
|
## API
|
|
@@ -76,7 +82,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
|
|
|
76
82
|
your project's skill store (`.agents/skills/`):
|
|
77
83
|
|
|
78
84
|
```sh
|
|
79
|
-
npx @owlmeans/agent-skills@^0.1.18-rc.
|
|
85
|
+
npx @owlmeans/agent-skills@^0.1.18-rc.15
|
|
80
86
|
```
|
|
81
87
|
|
|
82
88
|
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/server-auth",
|
|
4
|
-
"version": "0.1.18-rc.
|
|
5
|
-
"generatedAt": "2026-09-
|
|
4
|
+
"version": "0.1.18-rc.21",
|
|
5
|
+
"generatedAt": "2026-09-12T08:39:52.721Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -8,7 +8,7 @@ user-invocable: false
|
|
|
8
8
|
# @owlmeans/server-auth
|
|
9
9
|
|
|
10
10
|
**Layer:** Server
|
|
11
|
-
**Install:** `"@owlmeans/server-auth": "^0.1.18-rc.
|
|
11
|
+
**Install:** `"@owlmeans/server-auth": "^0.1.18-rc.21"` in `dependencies`
|
|
12
12
|
|
|
13
13
|
Two halves, deliberately split by subpath:
|
|
14
14
|
|
|
@@ -25,7 +25,7 @@ An ordinary service imports the root. Only the auth manager imports `./manager`.
|
|
|
25
25
|
|--------|-------------|
|
|
26
26
|
| `appendAuthService(ctx, alias?)` | Register the guard on a server context and expose it as `context.auth()`. Registers a static `AUTH_CACHE` resource when the context has none |
|
|
27
27
|
| `makeAuthService(alias?)` | The guard service itself: `match`, `handle`, `unpack(token)`, `authenticate(token)` |
|
|
28
|
-
| `entrypoints` | `DISPATCHER` and `DISPATCHER_AUTHEN`,
|
|
28
|
+
| `entrypoints` | `DISPATCHER` and `DISPATCHER_AUTHEN`, server-bound — spread these into a service that accepts a manager-issued credential and exchanges it for a bearer |
|
|
29
29
|
| `DEFAULT_ALIAS` | `'auth'` — the guard's service alias, matching `DEFAULT_GUARD` |
|
|
30
30
|
| `AUTH_CACHE` | `'auth-cache'` — the single-use challenge store |
|
|
31
31
|
| `AUTH_SRV_KEY` | `'auth-service'` — the TRUSTED record whose key signs credential envelopes |
|
|
@@ -40,14 +40,14 @@ An ordinary service imports the root. Only the auth manager imports `./manager`.
|
|
|
40
40
|
| `makeContext(cfg, customize?)` | A server context preconfigured with the API server, API client, socket service and static `AUTH_CACHE` |
|
|
41
41
|
| `main(ctx)` | Register the manager entrypoints, configure, init and listen |
|
|
42
42
|
| `entrypoints` | `AUTHEN`, `AUTHEN_INIT`, `AUTHEN_AUTHEN`, `AUTHEN_RELY`, the api-config entrypoints and the reCAPTCHA siteverify entrypoint |
|
|
43
|
-
| `authenticationInit`, `authenticate`, `rely` |
|
|
43
|
+
| `authenticationInit`, `authenticate`, `rely` | Implementations bound to auth protocols: `init(request)` → challenge, `authenticate(credential)` → signed credential envelope, and the rely socket |
|
|
44
44
|
| `plugins`, `registerPlugin(type, factory)` | The plugin registry (also on `./manager/plugins`) |
|
|
45
45
|
| `appendSupervisorAuth(ctx, opts?)`, `setupInternalTokenCoguard(entrypoints, guard?)` | PK supervisor login — see the `supervisor-auth` skill |
|
|
46
46
|
| `createRelyService(alias?)`, `DEFAULT_RELY`, `RELY_TUNNEL` | The rely guard service |
|
|
47
47
|
| `AppConfig`, `AppContext`, `AuthModel`, `RelyService`, `RelyAllowanceRequest`, `RelyLinker`, `RelyCarrier` | Types |
|
|
48
48
|
|
|
49
49
|
`./manager` also re-exports the handful of symbols a manager application needs from elsewhere
|
|
50
|
-
(`config`, `service`, `TRUSTED`, `
|
|
50
|
+
(`config`, `service`, `TRUSTED`, `bind`, `handlers`, `backend`,
|
|
51
51
|
`GUARD_ED25519`, `AUTHEN*` aliases, `TrustedRecord`), so a manager app can be written against this
|
|
52
52
|
one import.
|
|
53
53
|
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { EntrypointProtocol } from '@owlmeans/entrypoint';
|
|
2
2
|
import type { AuthToken } from '@owlmeans/auth';
|
|
3
|
-
export declare const authenticate:
|
|
3
|
+
export declare const authenticate: (protocol: EntrypointProtocol<{
|
|
4
|
+
body: AuthToken;
|
|
5
|
+
}, AuthToken>) => import("@owlmeans/server-entrypoint").BoundEntrypointHandler<EntrypointProtocol<{
|
|
6
|
+
body: AuthToken;
|
|
7
|
+
}, AuthToken>>;
|
|
4
8
|
//# sourceMappingURL=service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/actions/service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/actions/service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAS/C,eAAO,MAAM,YAAY,aAAc,kBAAkB,CAAC;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,EAAE,SAAS,CAAC;UAAvB,SAAS;cAKvE,CAAA"}
|
package/build/actions/service.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { handlers } from '@owlmeans/server-api';
|
|
2
2
|
import { assertContext } from '@owlmeans/context';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const api = handlers();
|
|
4
|
+
export const authenticate = (protocol) => api.request(protocol, async (request, context) => {
|
|
5
|
+
const ctx = assertContext(context, 'authenticate');
|
|
6
|
+
return await ctx.auth().authenticate(request.body);
|
|
6
7
|
});
|
|
7
8
|
//# sourceMappingURL=service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/actions/service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/actions/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAK/C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAIjD,MAAM,GAAG,GAAG,QAAQ,EAAW,CAAA;AAE/B,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,QAA4D,EAAE,EAAE,CAC3F,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;IAC/C,MAAM,GAAG,GAAG,aAAa,CAAC,OAAO,EAAE,cAAc,CAAY,CAAA;IAE7D,OAAO,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;AACpD,CAAC,CAAC,CAAA"}
|
package/build/entrypoints.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { ServerProtocolEntrypoint } from '@owlmeans/server-entrypoint';
|
|
2
|
+
import type { EntrypointProtocolDeclaration } from '@owlmeans/entrypoint';
|
|
3
|
+
/** Server entrypoints required by the generic authentication service. */
|
|
4
|
+
export declare const entrypoints: ServerProtocolEntrypoint<EntrypointProtocolDeclaration>[];
|
|
3
5
|
//# sourceMappingURL=entrypoints.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entrypoints.d.ts","sourceRoot":"","sources":["../src/entrypoints.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"entrypoints.d.ts","sourceRoot":"","sources":["../src/entrypoints.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAA;AAE3E,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAA;AAGzE,yEAAyE;AACzE,eAAO,MAAM,WAAW,EAAE,wBAAwB,CAAC,6BAA6B,CAAC,EAGhF,CAAA"}
|
package/build/entrypoints.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { DISPATCHER, DISPATCHER_AUTHEN } from '@owlmeans/auth';
|
|
1
|
+
import { bind } from '@owlmeans/server-entrypoint';
|
|
2
|
+
import { authProtocols } from '@owlmeans/auth-common';
|
|
4
3
|
import { authenticate } from './actions/service.js';
|
|
5
|
-
|
|
6
|
-
elevate(list, DISPATCHER_AUTHEN, authenticate);
|
|
7
|
-
celevate(list, DISPATCHER, stab);
|
|
4
|
+
/** Server entrypoints required by the generic authentication service. */
|
|
8
5
|
export const entrypoints = [
|
|
9
|
-
|
|
6
|
+
bind(authProtocols.dispatcher),
|
|
7
|
+
bind(authProtocols.dispatcherAuthenticate, authenticate(authProtocols.dispatcherAuthenticate)),
|
|
10
8
|
];
|
|
11
9
|
//# 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,MAAM,6BAA6B,CAAA;AAElD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAEnD,yEAAyE;AACzE,MAAM,CAAC,MAAM,WAAW,GAA8D;IACpF,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC;IAC9B,IAAI,CAAC,aAAa,CAAC,sBAAsB,EAAE,YAAY,CAAC,aAAa,CAAC,sBAAsB,CAAC,CAAC;CAC/F,CAAA"}
|
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
import type { AllowanceRequest, AuthCredentials } from '@owlmeans/auth';
|
|
2
|
-
import type {
|
|
3
|
-
export declare const authenticationInit:
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import type { AllowanceRequest, AllowanceResponse, AuthCredentials, AuthToken } from '@owlmeans/auth';
|
|
2
|
+
import type { EntrypointProtocol } from '@owlmeans/entrypoint';
|
|
3
|
+
export declare const authenticationInit: (protocol: EntrypointProtocol<{
|
|
4
|
+
body: AllowanceRequest;
|
|
5
|
+
}, AllowanceResponse>) => import("@owlmeans/server-entrypoint").BoundEntrypointHandler<EntrypointProtocol<{
|
|
6
|
+
body: AllowanceRequest;
|
|
7
|
+
}, AllowanceResponse>>;
|
|
8
|
+
export declare const authenticate: (protocol: EntrypointProtocol<{
|
|
9
|
+
body: AuthCredentials;
|
|
10
|
+
}, AuthToken>) => import("@owlmeans/server-entrypoint").BoundEntrypointHandler<EntrypointProtocol<{
|
|
11
|
+
body: AuthCredentials;
|
|
12
|
+
}, AuthToken>>;
|
|
13
|
+
export declare const rely: (protocol: EntrypointProtocol<{
|
|
14
|
+
query: Partial<AuthToken>;
|
|
15
|
+
}, undefined>) => import("@owlmeans/server-entrypoint").BoundEntrypointHandler<EntrypointProtocol<{
|
|
16
|
+
query: Partial<AuthToken>;
|
|
17
|
+
}, undefined>>;
|
|
6
18
|
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../src/manager/actions/manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../src/manager/actions/manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AACrG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAQ9D,eAAO,MAAM,kBAAkB,aAAc,kBAAkB,CAAC;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,EAAE,iBAAiB,CAAC;UAAtC,gBAAgB;sBAGvF,CAAA;AAED,eAAO,MAAM,YAAY,aAAc,kBAAkB,CAAC;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE,EAAE,SAAS,CAAC;UAA7B,eAAe;cAGhF,CAAA;AAED,eAAO,MAAM,IAAI,aAAc,kBAAkB,CAAC;IAAE,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;CAAE,EAAE,SAAS,CAAC;WAAhC,OAAO,CAAC,SAAS,CAAC;cAK5E,CAAA"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { handlers } from '@owlmeans/server-api';
|
|
2
2
|
import { makeAuthModel } from '../model.js';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export const
|
|
6
|
-
export const
|
|
3
|
+
import { connection } from '@owlmeans/server-socket';
|
|
4
|
+
const api = handlers();
|
|
5
|
+
export const authenticationInit = (protocol) => api.body(protocol, async (body, context) => await makeAuthModel(context).init(body));
|
|
6
|
+
export const authenticate = (protocol) => api.body(protocol, async (body, context) => await makeAuthModel(context).authenticate(body));
|
|
7
|
+
export const rely = (protocol) => connection(protocol,
|
|
7
8
|
// @TODO Request will contain information is there requrest
|
|
8
9
|
// privileged or not (privileged request implies auth provider)
|
|
9
|
-
async (conn,
|
|
10
|
+
async (conn, context, request) => await makeAuthModel(context).rely(conn, request.auth));
|
|
10
11
|
//# sourceMappingURL=manager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.js","sourceRoot":"","sources":["../../../src/manager/actions/manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"manager.js","sourceRoot":"","sources":["../../../src/manager/actions/manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAEpD,MAAM,GAAG,GAAG,QAAQ,EAAyB,CAAA;AAE7C,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,QAA2E,EAAE,EAAE,CAChH,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,CAC3C,MAAM,aAAa,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CACxC,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,QAAkE,EAAE,EAAE,CACjG,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,CAC3C,MAAM,aAAa,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAChD,CAAA;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,QAAsE,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ;AACjH,4DAA4D;AAC5D,+DAA+D;AAC/D,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,CAC/B,MAAM,aAAa,CAAC,OAAgC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CACjF,CAAA"}
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/** Server entrypoints for the full authentication manager. */
|
|
2
|
+
export declare const entrypoints: (import("@owlmeans/server-entrypoint").ServerProtocolEntrypoint<import("@owlmeans/entrypoint").EntrypointProtocol<import("@owlmeans/entrypoint").OpenRequest, import("@owlmeans/entrypoint").OpenValue>> | import("@owlmeans/server-entrypoint").ServerProtocolEntrypoint<import("@owlmeans/entrypoint").EntrypointProtocol<{
|
|
3
|
+
body: import("@owlmeans/auth").AllowanceRequest;
|
|
4
|
+
}, import("@owlmeans/auth").AllowanceResponse>> | import("@owlmeans/server-entrypoint").ServerProtocolEntrypoint<import("@owlmeans/entrypoint").EntrypointProtocol<{
|
|
5
|
+
body: import("@owlmeans/auth").AuthCredentials;
|
|
6
|
+
}, import("@owlmeans/auth").AuthToken>> | import("@owlmeans/server-entrypoint").ServerProtocolEntrypoint<import("@owlmeans/entrypoint").EntrypointProtocol<{
|
|
7
|
+
query: Partial<import("@owlmeans/auth").AuthToken>;
|
|
8
|
+
}, undefined>>)[];
|
|
2
9
|
//# 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":"AAiBA,8DAA8D;AAC9D,eAAO,MAAM,WAAW;;;;;;iBAOvB,CAAA"}
|
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { entrypoints as
|
|
4
|
-
import {
|
|
1
|
+
import { MOD_RECAPTCHA } from '@owlmeans/auth';
|
|
2
|
+
import { authProtocols } from '@owlmeans/auth-common';
|
|
3
|
+
import { entrypoints as apiConfigBindings } from '@owlmeans/api-config-server';
|
|
4
|
+
import { bind } from '@owlmeans/server-entrypoint';
|
|
5
|
+
import { decorateEntrypoint, openProtocol } from '@owlmeans/entrypoint';
|
|
5
6
|
import * as actions from './actions/index.js';
|
|
6
|
-
import { entrypoint } from '@owlmeans/client-entrypoint';
|
|
7
7
|
import { backend, route, RouteMethod } from '@owlmeans/route';
|
|
8
|
-
import { handleIntermediate } from '@owlmeans/server-api';
|
|
9
8
|
import { DEFAULT_RELY } from './consts.js';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
elevate(list, AUTHEN_AUTHEN, actions.authenticate);
|
|
13
|
-
elevate(list, AUTHEN_RELY, actions.rely, guard(DEFAULT_RELY));
|
|
14
|
-
export const entrypoints = list;
|
|
15
|
-
list.push(...apiConfig);
|
|
16
|
-
list.push(entrypoint(route(MOD_RECAPTCHA, '/api/siteverify', backend({
|
|
9
|
+
const relyProtocol = decorateEntrypoint(authProtocols.rely, { guards: DEFAULT_RELY });
|
|
10
|
+
const reCaptchaProtocol = openProtocol(route(MOD_RECAPTCHA, '/api/siteverify', backend({
|
|
17
11
|
host: 'https://www.google.com',
|
|
18
12
|
base: 'recaptcha',
|
|
19
13
|
secure: true,
|
|
20
|
-
}, RouteMethod.POST)))
|
|
14
|
+
}, RouteMethod.POST)));
|
|
15
|
+
/** Server entrypoints for the full authentication manager. */
|
|
16
|
+
export const entrypoints = [
|
|
17
|
+
bind(authProtocols.authen, undefined, { intermediate: true }),
|
|
18
|
+
bind(authProtocols.init, actions.authenticationInit(authProtocols.init)),
|
|
19
|
+
bind(authProtocols.authenticate, actions.authenticate(authProtocols.authenticate)),
|
|
20
|
+
bind(relyProtocol, actions.rely(relyProtocol)),
|
|
21
|
+
...apiConfigBindings,
|
|
22
|
+
bind(reCaptchaProtocol),
|
|
23
|
+
];
|
|
21
24
|
//# 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,gBAAgB,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAE,WAAW,IAAI,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAC9E,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAA;AAClD,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACvE,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,MAAM,YAAY,GAAG,kBAAkB,CAAC,aAAa,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAA;AACrF,MAAM,iBAAiB,GAAG,YAAY,CAAC,KAAK,CAAC,aAAa,EAAE,iBAAiB,EAAE,OAAO,CAAC;IACrF,IAAI,EAAE,wBAAwB;IAC9B,IAAI,EAAE,WAAW;IACjB,MAAM,EAAE,IAAI;CACb,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AAEtB,8DAA8D;AAC9D,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;IAC7D,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,kBAAkB,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IACxE,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;IAClF,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC9C,GAAG,iBAAiB;IACpB,IAAI,CAAC,iBAAiB,CAAC;CACxB,CAAA"}
|
|
@@ -4,8 +4,7 @@ export { addWebService } from '@owlmeans/client-config';
|
|
|
4
4
|
export { service, TRUSTED } from '@owlmeans/config';
|
|
5
5
|
export { AppType, assertContext } from '@owlmeans/context';
|
|
6
6
|
export { klusterize } from '@owlmeans/kluster';
|
|
7
|
-
export {
|
|
8
|
-
export { elevate as celevate, stab } from '@owlmeans/client-entrypoint';
|
|
7
|
+
export { stab } from '@owlmeans/client-entrypoint';
|
|
9
8
|
export type { RefedEntrypointHandler } from '@owlmeans/server-entrypoint';
|
|
10
9
|
export { handleIntermediate, handleBody, handleRequest, handleParams } from '@owlmeans/server-api';
|
|
11
10
|
export type { AbstractRequest, AbstractResponse } from '@owlmeans/entrypoint';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../src/manager/exports.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACjD,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../src/manager/exports.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACjD,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAA;AAClD,YAAY,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACzE,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAClG,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAEzC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACnE,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA"}
|
package/build/manager/exports.js
CHANGED
|
@@ -3,8 +3,7 @@ export { addWebService } from '@owlmeans/client-config';
|
|
|
3
3
|
export { service, TRUSTED } from '@owlmeans/config';
|
|
4
4
|
export { AppType, assertContext } from '@owlmeans/context';
|
|
5
5
|
export { klusterize } from '@owlmeans/kluster';
|
|
6
|
-
export {
|
|
7
|
-
export { elevate as celevate, stab } from '@owlmeans/client-entrypoint';
|
|
6
|
+
export { stab } from '@owlmeans/client-entrypoint';
|
|
8
7
|
export { handleIntermediate, handleBody, handleRequest, handleParams } from '@owlmeans/server-api';
|
|
9
8
|
export { backend } from '@owlmeans/route';
|
|
10
9
|
export { AUTHEN, AUTHEN_AUTHEN, AUTHEN_INIT } from '@owlmeans/auth';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../../src/manager/exports.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../../src/manager/exports.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAA;AAElD,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAElG,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAEzC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACnE,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { RelyToken } from '@owlmeans/auth';
|
|
2
|
+
import type { EnvelopeModel } from '@owlmeans/basic-envelope';
|
|
1
3
|
import type { RelyOptions } from './types.js';
|
|
2
|
-
export declare const makeConsumerRely: (opts?: RelyOptions) =>
|
|
4
|
+
export declare const makeConsumerRely: (opts?: RelyOptions) => EnvelopeModel<RelyToken>;
|
|
3
5
|
//# sourceMappingURL=consumer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consumer.d.ts","sourceRoot":"","sources":["../../../src/model/rely/consumer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C,eAAO,MAAM,gBAAgB,UAAW,WAAW,
|
|
1
|
+
{"version":3,"file":"consumer.d.ts","sourceRoot":"","sources":["../../../src/model/rely/consumer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C,eAAO,MAAM,gBAAgB,UAAW,WAAW,KAAG,aAAa,CAAC,SAAS,CAO5E,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consumer.js","sourceRoot":"","sources":["../../../src/model/rely/consumer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"consumer.js","sourceRoot":"","sources":["../../../src/model/rely/consumer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAKzC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAkB,EAA4B,EAAE;IAC/E,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,CAAA;IACjC,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,EAAE,CAAA;IAC3B,OAAO,GAAG,CAAC,GAAG,CAAA;IACd,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAEf,OAAO,KAAK,CAAA;AACd,CAAC,CAAA"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { RelyToken } from '@owlmeans/auth';
|
|
2
|
+
import type { EnvelopeModel } from '@owlmeans/basic-envelope';
|
|
1
3
|
import type { RelyOptions } from './types.js';
|
|
2
|
-
export declare const makeProviderRely: (opts?: RelyOptions) =>
|
|
4
|
+
export declare const makeProviderRely: (opts?: RelyOptions) => EnvelopeModel<RelyToken>;
|
|
3
5
|
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/model/rely/provider.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C,eAAO,MAAM,gBAAgB,UAAW,WAAW,
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/model/rely/provider.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C,eAAO,MAAM,gBAAgB,UAAW,WAAW,KAAG,aAAa,CAAC,SAAS,CAI5E,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../src/model/rely/provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../src/model/rely/provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAKzC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAkB,EAA4B,EAAE;IAC/E,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,CAAA;IAEjC,OAAO,KAAK,CAAA;AACd,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlmeans/server-auth",
|
|
3
|
-
"version": "0.1.18-rc.
|
|
3
|
+
"version": "0.1.18-rc.21",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -37,29 +37,29 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@noble/hashes": "^1.5.0",
|
|
40
|
-
"@owlmeans/api": "^0.1.18-rc.
|
|
41
|
-
"@owlmeans/api-config-server": "^0.1.18-rc.
|
|
42
|
-
"@owlmeans/auth": "^0.1.18-rc.
|
|
43
|
-
"@owlmeans/auth-common": "^0.1.18-rc.
|
|
44
|
-
"@owlmeans/basic-envelope": "^0.1.18-rc.
|
|
45
|
-
"@owlmeans/basic-ids": "^0.1.18-rc.
|
|
46
|
-
"@owlmeans/basic-keys": "^0.1.18-rc.
|
|
47
|
-
"@owlmeans/client-config": "^0.1.18-rc.
|
|
48
|
-
"@owlmeans/client-entrypoint": "^0.1.18-rc.
|
|
49
|
-
"@owlmeans/config": "^0.1.18-rc.
|
|
50
|
-
"@owlmeans/context": "^0.1.18-rc.
|
|
51
|
-
"@owlmeans/kluster": "^0.1.18-rc.
|
|
52
|
-
"@owlmeans/entrypoint": "^0.1.18-rc.
|
|
53
|
-
"@owlmeans/redis-resource": "^0.1.18-rc.
|
|
54
|
-
"@owlmeans/resource": "^0.1.18-rc.
|
|
55
|
-
"@owlmeans/route": "^0.1.18-rc.
|
|
56
|
-
"@owlmeans/server-api": "^0.1.18-rc.
|
|
57
|
-
"@owlmeans/server-context": "^0.1.18-rc.
|
|
58
|
-
"@owlmeans/server-entrypoint": "^0.1.18-rc.
|
|
59
|
-
"@owlmeans/server-route": "^0.1.18-rc.
|
|
60
|
-
"@owlmeans/server-socket": "^0.1.18-rc.
|
|
61
|
-
"@owlmeans/socket": "^0.1.18-rc.
|
|
62
|
-
"@owlmeans/static-resource": "^0.1.18-rc.
|
|
40
|
+
"@owlmeans/api": "^0.1.18-rc.16",
|
|
41
|
+
"@owlmeans/api-config-server": "^0.1.18-rc.20",
|
|
42
|
+
"@owlmeans/auth": "^0.1.18-rc.12",
|
|
43
|
+
"@owlmeans/auth-common": "^0.1.18-rc.16",
|
|
44
|
+
"@owlmeans/basic-envelope": "^0.1.18-rc.15",
|
|
45
|
+
"@owlmeans/basic-ids": "^0.1.18-rc.12",
|
|
46
|
+
"@owlmeans/basic-keys": "^0.1.18-rc.15",
|
|
47
|
+
"@owlmeans/client-config": "^0.1.18-rc.15",
|
|
48
|
+
"@owlmeans/client-entrypoint": "^0.1.18-rc.16",
|
|
49
|
+
"@owlmeans/config": "^0.1.18-rc.15",
|
|
50
|
+
"@owlmeans/context": "^0.1.18-rc.11",
|
|
51
|
+
"@owlmeans/kluster": "^0.1.18-rc.15",
|
|
52
|
+
"@owlmeans/entrypoint": "^0.1.18-rc.14",
|
|
53
|
+
"@owlmeans/redis-resource": "^0.1.18-rc.15",
|
|
54
|
+
"@owlmeans/resource": "^0.1.18-rc.12",
|
|
55
|
+
"@owlmeans/route": "^0.1.18-rc.12",
|
|
56
|
+
"@owlmeans/server-api": "^0.1.18-rc.20",
|
|
57
|
+
"@owlmeans/server-context": "^0.1.18-rc.15",
|
|
58
|
+
"@owlmeans/server-entrypoint": "^0.1.18-rc.14",
|
|
59
|
+
"@owlmeans/server-route": "^0.1.18-rc.12",
|
|
60
|
+
"@owlmeans/server-socket": "^0.1.18-rc.21",
|
|
61
|
+
"@owlmeans/socket": "^0.1.18-rc.12",
|
|
62
|
+
"@owlmeans/static-resource": "^0.1.18-rc.12",
|
|
63
63
|
"@scure/base": "^2.3.0"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@owlmeans/dep-config": "workspace:*",
|
|
70
|
-
"@owlmeans/test-auth": "^0.1.18-rc.
|
|
70
|
+
"@owlmeans/test-auth": "^0.1.18-rc.16",
|
|
71
71
|
"@types/bun": "^1.4.0",
|
|
72
72
|
"@types/node": "^26.1.0",
|
|
73
73
|
"nodemon": "^3.1.14",
|
package/src/actions/service.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { handlers } from '@owlmeans/server-api'
|
|
2
|
+
import type { EntrypointProtocol } from '@owlmeans/entrypoint'
|
|
2
3
|
import type { AuthToken } from '@owlmeans/auth'
|
|
3
|
-
import { handleBody } from '@owlmeans/server-api'
|
|
4
4
|
import { AuthServiceAppend } from '../types.js'
|
|
5
5
|
import type { ServerConfig, ServerContext } from '@owlmeans/server-context'
|
|
6
6
|
import { assertContext } from '@owlmeans/context'
|
|
7
7
|
|
|
8
8
|
type Config = ServerConfig
|
|
9
9
|
type Context = ServerContext<Config> & AuthServiceAppend
|
|
10
|
+
const api = handlers<Context>()
|
|
10
11
|
|
|
11
|
-
export const authenticate:
|
|
12
|
-
async (
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
)
|
|
12
|
+
export const authenticate = (protocol: EntrypointProtocol<{ body: AuthToken }, AuthToken>) =>
|
|
13
|
+
api.request(protocol, async (request, context) => {
|
|
14
|
+
const ctx = assertContext(context, 'authenticate') as Context
|
|
15
|
+
|
|
16
|
+
return await ctx.auth().authenticate(request.body)
|
|
17
|
+
})
|
package/src/entrypoints.ts
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import type {
|
|
2
|
+
import { bind } from '@owlmeans/server-entrypoint'
|
|
3
|
+
import type { ServerProtocolEntrypoint } from '@owlmeans/server-entrypoint'
|
|
4
|
+
import { authProtocols } from '@owlmeans/auth-common'
|
|
5
|
+
import type { EntrypointProtocolDeclaration } from '@owlmeans/entrypoint'
|
|
6
6
|
import { authenticate } from './actions/service.js'
|
|
7
|
-
import { stab, elevate as celevate } from '@owlmeans/client-entrypoint'
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
...list.filter(
|
|
14
|
-
(module): module is ServerEntrypoint<unknown> =>
|
|
15
|
-
[DISPATCHER, DISPATCHER_AUTHEN].includes(module.alias)
|
|
16
|
-
)
|
|
8
|
+
/** Server entrypoints required by the generic authentication service. */
|
|
9
|
+
export const entrypoints: ServerProtocolEntrypoint<EntrypointProtocolDeclaration>[] = [
|
|
10
|
+
bind(authProtocols.dispatcher),
|
|
11
|
+
bind(authProtocols.dispatcherAuthenticate, authenticate(authProtocols.dispatcherAuthenticate)),
|
|
17
12
|
]
|
package/src/manager/README.md
CHANGED
|
@@ -27,11 +27,11 @@ A specialized guard service that enables authentication token relay between micr
|
|
|
27
27
|
- **Wallet DID Authentication**: Decentralized identity authentication support
|
|
28
28
|
- **Challenge Validation**: Anti-replay protection using challenge-response mechanisms
|
|
29
29
|
|
|
30
|
-
###
|
|
31
|
-
The manager is built on the OwlMeans
|
|
30
|
+
### Entrypoint-Based Architecture
|
|
31
|
+
The manager is built on the OwlMeans entrypoint system, providing:
|
|
32
32
|
- **Route Management**: Standardized API endpoints for authentication operations
|
|
33
|
-
- **Handler Registration**:
|
|
34
|
-
- **Guard Integration**: Automatic security enforcement at the
|
|
33
|
+
- **Handler Registration**: Protocol-backed request handlers for different authentication flows
|
|
34
|
+
- **Guard Integration**: Automatic security enforcement at the entrypoint level
|
|
35
35
|
|
|
36
36
|
## Installation
|
|
37
37
|
|
|
@@ -317,20 +317,16 @@ await authModel.rely(connection, authToken.auth)
|
|
|
317
317
|
|
|
318
318
|
### API Integration
|
|
319
319
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
// The manager automatically registers these API endpoints:
|
|
320
|
+
`main(context)` registers the manager's immutable `entrypoints` and starts the API server. For a
|
|
321
|
+
custom bootstrap, register the exported collection yourself; the manager's protocols are then
|
|
322
|
+
addressed through the same `context.entrypoint(protocol)` lookup as application endpoints.
|
|
324
323
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
// WebSocket /api/auth/rely - Authentication relay
|
|
324
|
+
```typescript
|
|
325
|
+
import { entrypoints, makeContext } from '@owlmeans/server-auth/manager'
|
|
328
326
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
console.log(`Method: ${module.route.method}`)
|
|
333
|
-
})
|
|
327
|
+
const context = makeContext(config)
|
|
328
|
+
context.registerEntrypoints(entrypoints)
|
|
329
|
+
await context.configure().init()
|
|
334
330
|
```
|
|
335
331
|
|
|
336
332
|
## API Endpoints
|
|
@@ -504,4 +500,4 @@ This manager app depends on:
|
|
|
504
500
|
- [`@owlmeans/server-auth`](../../../README.md) - Parent server authentication package
|
|
505
501
|
- [`@owlmeans/auth`](../../../auth/README.md) - Core authentication library
|
|
506
502
|
- [`@owlmeans/client-auth`](../../../client-auth/README.md) - Client-side authentication
|
|
507
|
-
- [`@owlmeans/context`](../../../context/README.md) - Context management system
|
|
503
|
+
- [`@owlmeans/context`](../../../context/README.md) - Context management system
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
import type { AllowanceRequest, AuthCredentials } from '@owlmeans/auth'
|
|
2
|
-
import {
|
|
1
|
+
import type { AllowanceRequest, AllowanceResponse, AuthCredentials, AuthToken } from '@owlmeans/auth'
|
|
2
|
+
import type { EntrypointProtocol } from '@owlmeans/entrypoint'
|
|
3
|
+
import { handlers } from '@owlmeans/server-api'
|
|
3
4
|
import { makeAuthModel } from '../model.js'
|
|
4
|
-
import type { RefedEntrypointHandler } from '@owlmeans/server-entrypoint'
|
|
5
5
|
import type { AppContext, AppConfig } from '../types.js'
|
|
6
|
-
import {
|
|
6
|
+
import { connection } from '@owlmeans/server-socket'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const api = handlers<AppContext<AppConfig>>()
|
|
9
|
+
|
|
10
|
+
export const authenticationInit = (protocol: EntrypointProtocol<{ body: AllowanceRequest }, AllowanceResponse>) =>
|
|
11
|
+
api.body(protocol, async (body, context) =>
|
|
12
|
+
await makeAuthModel(context).init(body)
|
|
11
13
|
)
|
|
12
14
|
|
|
13
|
-
export const authenticate:
|
|
14
|
-
async (
|
|
15
|
-
|
|
15
|
+
export const authenticate = (protocol: EntrypointProtocol<{ body: AuthCredentials }, AuthToken>) =>
|
|
16
|
+
api.body(protocol, async (body, context) =>
|
|
17
|
+
await makeAuthModel(context).authenticate(body)
|
|
16
18
|
)
|
|
17
19
|
|
|
18
|
-
export const rely:
|
|
20
|
+
export const rely = (protocol: EntrypointProtocol<{ query: Partial<AuthToken> }, undefined>) => connection(protocol,
|
|
19
21
|
// @TODO Request will contain information is there requrest
|
|
20
22
|
// privileged or not (privileged request implies auth provider)
|
|
21
|
-
async (conn,
|
|
22
|
-
await makeAuthModel(
|
|
23
|
+
async (conn, context, request) =>
|
|
24
|
+
await makeAuthModel(context as AppContext<AppConfig>).rely(conn, request.auth)
|
|
23
25
|
)
|
|
@@ -1,29 +1,26 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { entrypoints as
|
|
5
|
-
import {
|
|
2
|
+
import { MOD_RECAPTCHA } from '@owlmeans/auth'
|
|
3
|
+
import { authProtocols } from '@owlmeans/auth-common'
|
|
4
|
+
import { entrypoints as apiConfigBindings } from '@owlmeans/api-config-server'
|
|
5
|
+
import { bind } from '@owlmeans/server-entrypoint'
|
|
6
|
+
import { decorateEntrypoint, openProtocol } from '@owlmeans/entrypoint'
|
|
6
7
|
import * as actions from './actions/index.js'
|
|
7
|
-
import { entrypoint } from '@owlmeans/client-entrypoint'
|
|
8
8
|
import { backend, route, RouteMethod } from '@owlmeans/route'
|
|
9
|
-
import { handleIntermediate } from '@owlmeans/server-api'
|
|
10
9
|
import { DEFAULT_RELY } from './consts.js'
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
const relyProtocol = decorateEntrypoint(authProtocols.rely, { guards: DEFAULT_RELY })
|
|
12
|
+
const reCaptchaProtocol = openProtocol(route(MOD_RECAPTCHA, '/api/siteverify', backend({
|
|
13
|
+
host: 'https://www.google.com',
|
|
14
|
+
base: 'recaptcha',
|
|
15
|
+
secure: true,
|
|
16
|
+
}, RouteMethod.POST)))
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
)
|
|
29
|
-
)
|
|
18
|
+
/** Server entrypoints for the full authentication manager. */
|
|
19
|
+
export const entrypoints = [
|
|
20
|
+
bind(authProtocols.authen, undefined, { intermediate: true }),
|
|
21
|
+
bind(authProtocols.init, actions.authenticationInit(authProtocols.init)),
|
|
22
|
+
bind(authProtocols.authenticate, actions.authenticate(authProtocols.authenticate)),
|
|
23
|
+
bind(relyProtocol, actions.rely(relyProtocol)),
|
|
24
|
+
...apiConfigBindings,
|
|
25
|
+
bind(reCaptchaProtocol),
|
|
26
|
+
]
|
package/src/manager/exports.ts
CHANGED
|
@@ -5,8 +5,7 @@ export { addWebService } from '@owlmeans/client-config'
|
|
|
5
5
|
export { service, TRUSTED } from '@owlmeans/config'
|
|
6
6
|
export { AppType, assertContext } from '@owlmeans/context'
|
|
7
7
|
export { klusterize } from '@owlmeans/kluster'
|
|
8
|
-
export {
|
|
9
|
-
export { elevate as celevate, stab } from '@owlmeans/client-entrypoint'
|
|
8
|
+
export { stab } from '@owlmeans/client-entrypoint'
|
|
10
9
|
export type { RefedEntrypointHandler } from '@owlmeans/server-entrypoint'
|
|
11
10
|
export { handleIntermediate, handleBody, handleRequest, handleParams } from '@owlmeans/server-api'
|
|
12
11
|
export type { AbstractRequest, AbstractResponse } from '@owlmeans/entrypoint'
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { makeRelyModel } from './peer.js'
|
|
2
|
+
import type { RelyToken } from '@owlmeans/auth'
|
|
3
|
+
import type { EnvelopeModel } from '@owlmeans/basic-envelope'
|
|
2
4
|
import type { RelyOptions } from './types.js'
|
|
3
5
|
|
|
4
|
-
export const makeConsumerRely = (opts?: RelyOptions) => {
|
|
6
|
+
export const makeConsumerRely = (opts?: RelyOptions): EnvelopeModel<RelyToken> => {
|
|
5
7
|
const model = makeRelyModel(opts)
|
|
6
8
|
const msg = model.message()
|
|
7
9
|
delete msg.pin
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
import { makeRelyModel } from './peer.js'
|
|
3
|
+
import type { RelyToken } from '@owlmeans/auth'
|
|
4
|
+
import type { EnvelopeModel } from '@owlmeans/basic-envelope'
|
|
3
5
|
import type { RelyOptions } from './types.js'
|
|
4
6
|
|
|
5
|
-
export const makeProviderRely = (opts?: RelyOptions) => {
|
|
7
|
+
export const makeProviderRely = (opts?: RelyOptions): EnvelopeModel<RelyToken> => {
|
|
6
8
|
const model = makeRelyModel(opts)
|
|
7
9
|
|
|
8
10
|
return model
|