@naylence/runtime 0.3.21 → 0.3.22
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/dist/browser/index.cjs +367 -396
- package/dist/browser/index.mjs +367 -396
- package/dist/cjs/naylence/fame/node/default-node-identity-policy.js +9 -41
- package/dist/cjs/version.js +2 -2
- package/dist/esm/naylence/fame/node/default-node-identity-policy.js +9 -41
- package/dist/esm/version.js +2 -2
- package/dist/node/index.cjs +367 -396
- package/dist/node/index.mjs +367 -396
- package/dist/node/node.cjs +389 -418
- package/dist/node/node.mjs +389 -418
- package/dist/types/naylence/fame/node/default-node-identity-policy.d.ts +6 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DefaultNodeIdentityPolicy = void 0;
|
|
4
4
|
const core_1 = require("@naylence/core");
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Default node identity policy that preserves the current node ID.
|
|
7
|
+
*
|
|
8
|
+
* This policy does NOT derive identity from tokens or grants.
|
|
9
|
+
* For token-subject-based identity, use TokenSubjectNodeIdentityPolicy.
|
|
10
|
+
*/
|
|
9
11
|
class DefaultNodeIdentityPolicy {
|
|
10
12
|
async resolveInitialNodeId(context) {
|
|
11
13
|
if (context.configuredId) {
|
|
@@ -17,44 +19,10 @@ class DefaultNodeIdentityPolicy {
|
|
|
17
19
|
return await (0, core_1.generateIdAsync)({ mode: 'fingerprint' });
|
|
18
20
|
}
|
|
19
21
|
async resolveAdmissionNodeId(context) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
for (const grant of context.grants) {
|
|
23
|
-
try {
|
|
24
|
-
const auth = grant.auth;
|
|
25
|
-
if (!auth) {
|
|
26
|
-
continue;
|
|
27
|
-
}
|
|
28
|
-
const tokenProviderConfig = (auth.tokenProvider ??
|
|
29
|
-
auth.token_provider);
|
|
30
|
-
if (!tokenProviderConfig ||
|
|
31
|
-
typeof tokenProviderConfig.type !== 'string') {
|
|
32
|
-
continue;
|
|
33
|
-
}
|
|
34
|
-
const provider = await token_provider_factory_js_1.TokenProviderFactory.createTokenProvider(tokenProviderConfig);
|
|
35
|
-
if ((0, token_provider_js_1.isIdentityExposingTokenProvider)(provider)) {
|
|
36
|
-
const identity = await provider.getIdentity();
|
|
37
|
-
if (identity && identity.subject) {
|
|
38
|
-
logger.debug('identity_extracted_from_grant', {
|
|
39
|
-
identity_id: identity.subject,
|
|
40
|
-
grant_type: grant.type,
|
|
41
|
-
});
|
|
42
|
-
return identity.subject;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
logger.warning('identity_extraction_failed', {
|
|
48
|
-
error: error instanceof Error ? error.message : String(error),
|
|
49
|
-
grant_type: grant.type,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
22
|
+
if (context.currentNodeId) {
|
|
23
|
+
return context.currentNodeId;
|
|
53
24
|
}
|
|
54
|
-
|
|
55
|
-
return await (0, core_1.generateIdAsync)({ mode: 'fingerprint' });
|
|
56
|
-
}
|
|
57
|
-
return context.currentNodeId;
|
|
25
|
+
return await (0, core_1.generateIdAsync)({ mode: 'fingerprint' });
|
|
58
26
|
}
|
|
59
27
|
}
|
|
60
28
|
exports.DefaultNodeIdentityPolicy = DefaultNodeIdentityPolicy;
|
package/dist/cjs/version.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// This file is auto-generated during build - do not edit manually
|
|
3
|
-
// Generated from package.json version: 0.3.
|
|
3
|
+
// Generated from package.json version: 0.3.22
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.VERSION = void 0;
|
|
6
6
|
/**
|
|
7
7
|
* The package version, injected at build time.
|
|
8
8
|
* @internal
|
|
9
9
|
*/
|
|
10
|
-
exports.VERSION = '0.3.
|
|
10
|
+
exports.VERSION = '0.3.22';
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { generateIdAsync } from '@naylence/core';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Default node identity policy that preserves the current node ID.
|
|
4
|
+
*
|
|
5
|
+
* This policy does NOT derive identity from tokens or grants.
|
|
6
|
+
* For token-subject-based identity, use TokenSubjectNodeIdentityPolicy.
|
|
7
|
+
*/
|
|
6
8
|
export class DefaultNodeIdentityPolicy {
|
|
7
9
|
async resolveInitialNodeId(context) {
|
|
8
10
|
if (context.configuredId) {
|
|
@@ -14,43 +16,9 @@ export class DefaultNodeIdentityPolicy {
|
|
|
14
16
|
return await generateIdAsync({ mode: 'fingerprint' });
|
|
15
17
|
}
|
|
16
18
|
async resolveAdmissionNodeId(context) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
for (const grant of context.grants) {
|
|
20
|
-
try {
|
|
21
|
-
const auth = grant.auth;
|
|
22
|
-
if (!auth) {
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
const tokenProviderConfig = (auth.tokenProvider ??
|
|
26
|
-
auth.token_provider);
|
|
27
|
-
if (!tokenProviderConfig ||
|
|
28
|
-
typeof tokenProviderConfig.type !== 'string') {
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
const provider = await TokenProviderFactory.createTokenProvider(tokenProviderConfig);
|
|
32
|
-
if (isIdentityExposingTokenProvider(provider)) {
|
|
33
|
-
const identity = await provider.getIdentity();
|
|
34
|
-
if (identity && identity.subject) {
|
|
35
|
-
logger.debug('identity_extracted_from_grant', {
|
|
36
|
-
identity_id: identity.subject,
|
|
37
|
-
grant_type: grant.type,
|
|
38
|
-
});
|
|
39
|
-
return identity.subject;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
catch (error) {
|
|
44
|
-
logger.warning('identity_extraction_failed', {
|
|
45
|
-
error: error instanceof Error ? error.message : String(error),
|
|
46
|
-
grant_type: grant.type,
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
19
|
+
if (context.currentNodeId) {
|
|
20
|
+
return context.currentNodeId;
|
|
50
21
|
}
|
|
51
|
-
|
|
52
|
-
return await generateIdAsync({ mode: 'fingerprint' });
|
|
53
|
-
}
|
|
54
|
-
return context.currentNodeId;
|
|
22
|
+
return await generateIdAsync({ mode: 'fingerprint' });
|
|
55
23
|
}
|
|
56
24
|
}
|
package/dist/esm/version.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// This file is auto-generated during build - do not edit manually
|
|
2
|
-
// Generated from package.json version: 0.3.
|
|
2
|
+
// Generated from package.json version: 0.3.22
|
|
3
3
|
/**
|
|
4
4
|
* The package version, injected at build time.
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
7
|
-
export const VERSION = '0.3.
|
|
7
|
+
export const VERSION = '0.3.22';
|