@owlmeans/oidc 0.1.18-rc.55 → 0.1.18-rc.56
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 +2 -2
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/oidc/SKILL.md +1 -1
- package/build/iam.d.ts +6 -0
- package/build/iam.d.ts.map +1 -0
- package/build/iam.js +2 -0
- package/build/iam.js.map +1 -0
- package/build/models.d.ts +8 -0
- package/build/models.d.ts.map +1 -0
- package/build/models.js +67 -0
- package/build/models.js.map +1 -0
- package/package.json +3 -3
- package/tests/guard.spec.d.ts +2 -0
- package/tests/guard.spec.d.ts.map +1 -0
- package/tests/guard.spec.js +32 -0
- package/tests/guard.spec.js.map +1 -0
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Shared OIDC protocol abstractions — guard/gate aliases, models, and immutable
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
bun add @owlmeans/oidc@^0.1.18-rc.
|
|
15
|
+
bun add @owlmeans/oidc@^0.1.18-rc.56
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
## Usage
|
|
@@ -95,7 +95,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
|
|
|
95
95
|
your project's skill store (`.agents/skills/`):
|
|
96
96
|
|
|
97
97
|
```sh
|
|
98
|
-
npx @owlmeans/agent-skills@^0.1.18-rc.
|
|
98
|
+
npx @owlmeans/agent-skills@^0.1.18-rc.51
|
|
99
99
|
```
|
|
100
100
|
|
|
101
101
|
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/oidc",
|
|
4
|
-
"version": "0.1.18-rc.
|
|
5
|
-
"generatedAt": "2026-10-
|
|
4
|
+
"version": "0.1.18-rc.56",
|
|
5
|
+
"generatedAt": "2026-10-06T11:45:57.664Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -8,7 +8,7 @@ user-invocable: false
|
|
|
8
8
|
# @owlmeans/oidc
|
|
9
9
|
|
|
10
10
|
**Layer:** Core
|
|
11
|
-
**Install:** `"@owlmeans/oidc": "^0.1.18-rc.
|
|
11
|
+
**Install:** `"@owlmeans/oidc": "^0.1.18-rc.56"` in `dependencies`
|
|
12
12
|
|
|
13
13
|
The shared half of the OIDC stack: no transport, no library. It owns the names, the shapes and the
|
|
14
14
|
guard that the server relying party (`@owlmeans/server-oidc-rp`), the browser relying party
|
package/build/iam.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** IAM-mode extension for OIDC shared config — lets IAM_MODE flow through standard config.
|
|
2
|
+
* Uses a string union to avoid a circular dep with @owlmeans/iam (which depends on @owlmeans/oidc). */
|
|
3
|
+
export interface OidcIamConfig {
|
|
4
|
+
iamMode?: 'keycloak' | 'integrated';
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=iam.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iam.d.ts","sourceRoot":"","sources":["../src/iam.ts"],"names":[],"mappings":"AAAA;wGACwG;AACxG,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,UAAU,GAAG,YAAY,CAAA;CACpC"}
|
package/build/iam.js
ADDED
package/build/iam.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iam.js","sourceRoot":"","sources":["../src/iam.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { JSONSchemaType } from 'ajv';
|
|
2
|
+
import type { OIDCAuthInitParams, OIDCClientAuthPayload, OidcOrganizationSwitch, OIDCTokenUpdate, ProviderProfileDetails } from './types.js';
|
|
3
|
+
export declare const OIDCAuthInitParamsSchema: JSONSchemaType<OIDCAuthInitParams>;
|
|
4
|
+
export declare const OIDCClientAuthPayloadSchema: JSONSchemaType<OIDCClientAuthPayload>;
|
|
5
|
+
export declare const OidcOrganizationSwitchSchema: JSONSchemaType<OidcOrganizationSwitch>;
|
|
6
|
+
export declare const OIDCTokenUpdateSchema: JSONSchemaType<OIDCTokenUpdate>;
|
|
7
|
+
export declare const ProviderProfileDetailsSchema: JSONSchemaType<ProviderProfileDetails>;
|
|
8
|
+
//# sourceMappingURL=models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AACzC,OAAO,KAAK,EACV,kBAAkB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,eAAe,EAAE,sBAAsB,EAC3G,MAAM,YAAY,CAAA;AAKnB,eAAO,MAAM,wBAAwB,EAAE,cAAc,CAAC,kBAAkB,CASvE,CAAA;AAED,eAAO,MAAM,2BAA2B,EAAE,cAAc,CAAC,qBAAqB,CAQ7E,CAAA;AAED,eAAO,MAAM,4BAA4B,EAAE,cAAc,CAAC,sBAAsB,CAO/E,CAAA;AAED,eAAO,MAAM,qBAAqB,EAAE,cAAc,CAAC,eAAe,CAqBjE,CAAA;AAED,eAAO,MAAM,4BAA4B,EAAE,cAAc,CAAC,sBAAsB,CAe/E,CAAA"}
|
package/build/models.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { AuthTokenSchema, EntitySlugValueSchema, EntityValueSchema, IdValueSchema, ScopeValueSchema, TypeNameSchema, } from '@owlmeans/auth';
|
|
2
|
+
export const OIDCAuthInitParamsSchema = {
|
|
3
|
+
type: 'object',
|
|
4
|
+
properties: {
|
|
5
|
+
entity: { ...EntityValueSchema, nullable: true },
|
|
6
|
+
profile: { ...IdValueSchema, nullable: true },
|
|
7
|
+
entitySlug: { ...EntitySlugValueSchema, nullable: true },
|
|
8
|
+
},
|
|
9
|
+
required: [],
|
|
10
|
+
additionalProperties: false,
|
|
11
|
+
};
|
|
12
|
+
export const OIDCClientAuthPayloadSchema = {
|
|
13
|
+
type: 'object',
|
|
14
|
+
properties: {
|
|
15
|
+
code: { type: 'string', minLength: 16, maxLength: 512 },
|
|
16
|
+
authUrl: { type: 'string', minLength: 0, maxLength: 1024, format: 'uri' },
|
|
17
|
+
},
|
|
18
|
+
additionalProperties: { type: 'string', minLength: 0, maxLength: 512 },
|
|
19
|
+
required: ['code', 'authUrl'],
|
|
20
|
+
};
|
|
21
|
+
export const OidcOrganizationSwitchSchema = {
|
|
22
|
+
type: 'object',
|
|
23
|
+
properties: {
|
|
24
|
+
entitySlug: { ...EntitySlugValueSchema },
|
|
25
|
+
},
|
|
26
|
+
required: ['entitySlug'],
|
|
27
|
+
additionalProperties: false,
|
|
28
|
+
};
|
|
29
|
+
export const OIDCTokenUpdateSchema = {
|
|
30
|
+
type: 'object',
|
|
31
|
+
properties: {
|
|
32
|
+
...AuthTokenSchema.properties,
|
|
33
|
+
tokenSet: {
|
|
34
|
+
type: 'object',
|
|
35
|
+
properties: {
|
|
36
|
+
access_token: { type: 'string', nullable: true },
|
|
37
|
+
token_type: { type: 'string', nullable: true },
|
|
38
|
+
id_token: { type: 'string', nullable: true },
|
|
39
|
+
refresh_token: { type: 'string', nullable: true },
|
|
40
|
+
scope: { type: 'string', nullable: true },
|
|
41
|
+
expires_at: { type: 'number', nullable: true },
|
|
42
|
+
session_state: { type: 'string', nullable: true }
|
|
43
|
+
},
|
|
44
|
+
required: [],
|
|
45
|
+
additionalProperties: true,
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
required: ['token', 'tokenSet'],
|
|
49
|
+
additionalProperties: false
|
|
50
|
+
};
|
|
51
|
+
export const ProviderProfileDetailsSchema = {
|
|
52
|
+
type: 'object',
|
|
53
|
+
properties: {
|
|
54
|
+
type: { ...TypeNameSchema },
|
|
55
|
+
service: { ...ScopeValueSchema },
|
|
56
|
+
clientId: { ...ScopeValueSchema },
|
|
57
|
+
userId: { ...IdValueSchema },
|
|
58
|
+
profileId: { ...IdValueSchema, nullable: true },
|
|
59
|
+
username: { type: 'string', minLength: 1, maxLength: 255, nullable: true },
|
|
60
|
+
entityId: { ...EntityValueSchema, nullable: true },
|
|
61
|
+
did: { ...IdValueSchema, nullable: true },
|
|
62
|
+
isOwlMeansId: { type: 'boolean', nullable: true }
|
|
63
|
+
},
|
|
64
|
+
required: ['type', 'service', 'clientId', 'userId'],
|
|
65
|
+
additionalProperties: false
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=models.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,eAAe,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,aAAa,EAAE,gBAAgB,EAAE,cAAc,GAC3G,MAAM,gBAAgB,CAAA;AAEvB,MAAM,CAAC,MAAM,wBAAwB,GAAuC;IAC1E,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,MAAM,EAAE,EAAE,GAAG,iBAAiB,EAAE,QAAQ,EAAE,IAAI,EAAE;QAChD,OAAO,EAAE,EAAE,GAAG,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC7C,UAAU,EAAE,EAAE,GAAG,qBAAqB,EAAE,QAAQ,EAAE,IAAI,EAAE;KACzD;IACD,QAAQ,EAAE,EAAE;IACZ,oBAAoB,EAAE,KAAK;CAC5B,CAAA;AAED,MAAM,CAAC,MAAM,2BAA2B,GAA0C;IAChF,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE;QACvD,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC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,EAAE,UAAU,CAAC;IAC/B,oBAAoB,EAAE,KAAK;CAC5B,CAAA;AAED,MAAM,CAAC,MAAM,4BAA4B,GAA2C;IAClF,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,IAAI,EAAE,EAAE,GAAG,cAAc,EAAE;QAC3B,OAAO,EAAE,EAAE,GAAG,gBAAgB,EAAE;QAChC,QAAQ,EAAE,EAAE,GAAG,gBAAgB,EAAE;QACjC,MAAM,EAAE,EAAE,GAAG,aAAa,EAAE;QAC5B,SAAS,EAAE,EAAC,GAAG,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC9C,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC1E,QAAQ,EAAE,EAAE,GAAG,iBAAiB,EAAE,QAAQ,EAAE,IAAI,EAAE;QAClD,GAAG,EAAE,EAAE,GAAG,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE;QACzC,YAAY,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE;KAClD;IACD,QAAQ,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,CAAC;IACnD,oBAAoB,EAAE,KAAK;CAC5B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlmeans/oidc",
|
|
3
|
-
"version": "0.1.18-rc.
|
|
3
|
+
"version": "0.1.18-rc.56",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@owlmeans/auth": "^0.1.18-rc.40",
|
|
25
|
-
"@owlmeans/auth-common": "^0.1.18-rc.
|
|
26
|
-
"@owlmeans/basic-envelope": "^0.1.18-rc.
|
|
25
|
+
"@owlmeans/auth-common": "^0.1.18-rc.48",
|
|
26
|
+
"@owlmeans/basic-envelope": "^0.1.18-rc.47",
|
|
27
27
|
"@owlmeans/config": "^0.1.18-rc.44",
|
|
28
28
|
"@owlmeans/context": "^0.1.18-rc.34",
|
|
29
29
|
"@owlmeans/entrypoint": "^0.1.18-rc.41",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guard.spec.d.ts","sourceRoot":"","sources":["guard.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { describe, expect, mock, test } from 'bun:test';
|
|
2
|
+
/**
|
|
3
|
+
* A bearer that cannot be decoded is a credential the server does not accept — the guard answers
|
|
4
|
+
* "not authenticated" (the API layer's 401), exactly as for a signature that does not verify, and
|
|
5
|
+
* never throws the decoder's own error (which the API layer answers with 500).
|
|
6
|
+
*/
|
|
7
|
+
mock.module('@owlmeans/auth-common/utils', () => ({
|
|
8
|
+
trust: async () => ({ key: { verify: async () => false } }),
|
|
9
|
+
extractAuthToken: (req, type, strip = true) => {
|
|
10
|
+
const header = req.headers.authorization;
|
|
11
|
+
if (header == null || !header.toUpperCase().startsWith(type.toUpperCase()))
|
|
12
|
+
return null;
|
|
13
|
+
return strip ? header.split(' ')[1] : header;
|
|
14
|
+
},
|
|
15
|
+
}));
|
|
16
|
+
const { makeOidcGuard } = await import('../src/guard.js');
|
|
17
|
+
const call = async (authorization) => {
|
|
18
|
+
const guard = makeOidcGuard();
|
|
19
|
+
guard.assertCtx = () => ({ cfg: { alias: 'app' } });
|
|
20
|
+
const res = { responseProvider: { header: () => undefined } };
|
|
21
|
+
return await guard.handle({ headers: { authorization } }, res);
|
|
22
|
+
};
|
|
23
|
+
describe('oidc guard', () => {
|
|
24
|
+
test('an undecodable wrapped token is unauthenticated, not a server error', async () => {
|
|
25
|
+
expect(await call('OIDC-WRAPPED-TOKEN bogus.token')).toBe(false);
|
|
26
|
+
});
|
|
27
|
+
test('garbage of every shape stays unauthenticated', async () => {
|
|
28
|
+
expect(await call('OIDC-WRAPPED-TOKEN %%%')).toBe(false);
|
|
29
|
+
expect(await call('OIDC-WRAPPED-TOKEN ')).toBe(false);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=guard.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guard.spec.js","sourceRoot":"","sources":["guard.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAEvD;;;;GAIG;AACH,IAAI,CAAC,MAAM,CAAC,6BAA6B,EAAE,GAAG,EAAE,CAAC,CAAC;IAChD,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,KAAK,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC;IAC3D,gBAAgB,EAAE,CAAC,GAAwC,EAAE,IAAY,EAAE,KAAK,GAAG,IAAI,EAAE,EAAE;QACzF,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,aAAa,CAAA;QACxC,IAAI,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YAAE,OAAO,IAAI,CAAA;QACvF,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAA;IAC9C,CAAC;CACF,CAAC,CAAC,CAAA;AAEH,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,CAAA;AAEzD,MAAM,IAAI,GAAG,KAAK,EAAE,aAAqB,EAAE,EAAE;IAC3C,MAAM,KAAK,GAAG,aAAa,EAAS,CAAA;IACpC,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