node-opcua-role-set-server 2.177.0 → 2.178.0
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.
|
@@ -45,6 +45,24 @@ export interface InstallRoleBasedSecurityOptions {
|
|
|
45
45
|
persistencePath?: string;
|
|
46
46
|
/** Encrypt that archive at rest (AES-256-GCM, key derived from this secret). */
|
|
47
47
|
persistenceSecret?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Install the `UserManagement` Object (OPC 10000-18 §5). Default `true`.
|
|
50
|
+
*
|
|
51
|
+
* Set `false` to model a server that implements the RoleSet — roles and
|
|
52
|
+
* their identity mappings — **without** the optional `UserManagement`
|
|
53
|
+
* companion Object. That shape is common in the field, and it behaves
|
|
54
|
+
* differently in a client in a way worth being able to test: `readUsers()`
|
|
55
|
+
* answers with an *empty list* rather than failing, because there is no API
|
|
56
|
+
* to enumerate accounts at all. A client cannot tell that apart from "this
|
|
57
|
+
* server has no users" unless it looks for the Object.
|
|
58
|
+
*
|
|
59
|
+
* **Authentication is unaffected.** The `userManager` bridge still validates
|
|
60
|
+
* credentials against the seeded user store and still resolves Roles; only
|
|
61
|
+
* the Object exposing user *administration* is left out. That is exactly the
|
|
62
|
+
* real-world case: the server knows its users, but offers no way to list or
|
|
63
|
+
* manage them over OPC UA.
|
|
64
|
+
*/
|
|
65
|
+
userManagement?: boolean;
|
|
48
66
|
}
|
|
49
67
|
/** The shared stores + bridge produced by {@link createRoleBasedSecurity}. */
|
|
50
68
|
export interface RoleBasedSecurity {
|
|
@@ -60,7 +78,8 @@ export interface RoleBasedSecurity {
|
|
|
60
78
|
*/
|
|
61
79
|
install(server: IServerForRoleSet & IServerForUserManagement, options?: InstallRoleBasedSecurityOptions): Promise<{
|
|
62
80
|
roleSet: InstallRoleSetResult;
|
|
63
|
-
userManagement:
|
|
81
|
+
/** Absent when `userManagement: false` — there is nothing to return. */
|
|
82
|
+
userManagement?: InstallUserManagementResult;
|
|
64
83
|
}>;
|
|
65
84
|
}
|
|
66
85
|
/**
|
|
@@ -107,6 +107,11 @@ async function createRoleBasedSecurity(options) {
|
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
109
|
const roleSet = await (0, install_role_set_js_1.installRoleSet)(server, { store: identityStore, persistence });
|
|
110
|
+
if (installOptions?.userManagement === false) {
|
|
111
|
+
// Deliberately no UserManagement Object. Credentials still work:
|
|
112
|
+
// the userManager bridge authenticates from userStore either way.
|
|
113
|
+
return { roleSet };
|
|
114
|
+
}
|
|
110
115
|
const userManagement = await (0, install_user_management_js_1.installUserManagement)(server, { store: userStore, persistence });
|
|
111
116
|
return { roleSet, userManagement };
|
|
112
117
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install_role_based_security.js","sourceRoot":"","sources":["../source/install_role_based_security.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"install_role_based_security.js","sourceRoot":"","sources":["../source/install_role_based_security.ts"],"names":[],"mappings":";;AA6IA,0DA4FC;AAzOD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,uDAAiD;AAEjD,2EAQoC;AACpC,uDAAwG;AACxG,+DAA0G;AAC1G,6EAIsC;AACtC,uFAAgG;AAEhG,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,mBAAmB,CAAC,CAAC;AAuFpD,MAAM,YAAY,GAAG,CAAC,QAAgB,EAA2B,EAAE,CAC/D,IAAI,0CAAuB,CAAC,EAAE,YAAY,EAAE,uCAAoB,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;AAErG;;;;GAIG;AACI,KAAK,UAAU,uBAAuB,CAAC,OAAwC;IAClF,MAAM,SAAS,GAAG,IAAI,wDAA2B,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;I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EAAE,aAAa,EAAE,WAAW,EAAE,CAAC,CAAC;YACpF,IAAI,cAAc,EAAE,cAAc,KAAK,KAAK,EAAE,CAAC;gBAC3C,iEAAiE;gBACjE,kEAAkE;gBAClE,OAAO,EAAE,OAAO,EAAE,CAAC;YACvB,CAAC;YACD,MAAM,cAAc,GAAG,MAAM,IAAA,kDAAqB,EAAC,MAAM,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC,CAAC;YAC9F,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;QACvC,CAAC;KACJ,CAAC;AACN,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-role-set-server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.178.0",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - server-side role-set management (OPC 10000-18)",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc -b",
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
"npm": ">=10.x"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"node-opcua-address-space": "2.
|
|
20
|
-
"node-opcua-address-space-base": "2.
|
|
19
|
+
"node-opcua-address-space": "2.178.0",
|
|
20
|
+
"node-opcua-address-space-base": "2.178.0",
|
|
21
21
|
"node-opcua-constants": "2.176.0",
|
|
22
22
|
"node-opcua-data-model": "2.177.0",
|
|
23
23
|
"node-opcua-debug": "2.175.6",
|
|
24
24
|
"node-opcua-nodeid": "2.177.0",
|
|
25
|
-
"node-opcua-role-set-common": "2.
|
|
25
|
+
"node-opcua-role-set-common": "2.178.0",
|
|
26
26
|
"node-opcua-service-call": "2.177.0",
|
|
27
27
|
"node-opcua-status-code": "2.176.0",
|
|
28
28
|
"node-opcua-types": "2.177.0",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"internet of things"
|
|
48
48
|
],
|
|
49
49
|
"homepage": "http://node-opcua.github.io/",
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "d0e850e5f7df80e14ceb6d8e092e793472965301",
|
|
51
51
|
"files": [
|
|
52
52
|
"dist",
|
|
53
53
|
"source"
|
|
@@ -89,6 +89,24 @@ export interface InstallRoleBasedSecurityOptions {
|
|
|
89
89
|
persistencePath?: string;
|
|
90
90
|
/** Encrypt that archive at rest (AES-256-GCM, key derived from this secret). */
|
|
91
91
|
persistenceSecret?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Install the `UserManagement` Object (OPC 10000-18 §5). Default `true`.
|
|
94
|
+
*
|
|
95
|
+
* Set `false` to model a server that implements the RoleSet — roles and
|
|
96
|
+
* their identity mappings — **without** the optional `UserManagement`
|
|
97
|
+
* companion Object. That shape is common in the field, and it behaves
|
|
98
|
+
* differently in a client in a way worth being able to test: `readUsers()`
|
|
99
|
+
* answers with an *empty list* rather than failing, because there is no API
|
|
100
|
+
* to enumerate accounts at all. A client cannot tell that apart from "this
|
|
101
|
+
* server has no users" unless it looks for the Object.
|
|
102
|
+
*
|
|
103
|
+
* **Authentication is unaffected.** The `userManager` bridge still validates
|
|
104
|
+
* credentials against the seeded user store and still resolves Roles; only
|
|
105
|
+
* the Object exposing user *administration* is left out. That is exactly the
|
|
106
|
+
* real-world case: the server knows its users, but offers no way to list or
|
|
107
|
+
* manage them over OPC UA.
|
|
108
|
+
*/
|
|
109
|
+
userManagement?: boolean;
|
|
92
110
|
}
|
|
93
111
|
|
|
94
112
|
/** The shared stores + bridge produced by {@link createRoleBasedSecurity}. */
|
|
@@ -106,7 +124,11 @@ export interface RoleBasedSecurity {
|
|
|
106
124
|
install(
|
|
107
125
|
server: IServerForRoleSet & IServerForUserManagement,
|
|
108
126
|
options?: InstallRoleBasedSecurityOptions
|
|
109
|
-
): Promise<{
|
|
127
|
+
): Promise<{
|
|
128
|
+
roleSet: InstallRoleSetResult;
|
|
129
|
+
/** Absent when `userManagement: false` — there is nothing to return. */
|
|
130
|
+
userManagement?: InstallUserManagementResult;
|
|
131
|
+
}>;
|
|
110
132
|
}
|
|
111
133
|
|
|
112
134
|
const userNameRule = (userName: string): IdentityMappingRuleType =>
|
|
@@ -200,6 +222,11 @@ export async function createRoleBasedSecurity(options?: CreateRoleBasedSecurityO
|
|
|
200
222
|
}
|
|
201
223
|
|
|
202
224
|
const roleSet = await installRoleSet(server, { store: identityStore, persistence });
|
|
225
|
+
if (installOptions?.userManagement === false) {
|
|
226
|
+
// Deliberately no UserManagement Object. Credentials still work:
|
|
227
|
+
// the userManager bridge authenticates from userStore either way.
|
|
228
|
+
return { roleSet };
|
|
229
|
+
}
|
|
203
230
|
const userManagement = await installUserManagement(server, { store: userStore, persistence });
|
|
204
231
|
return { roleSet, userManagement };
|
|
205
232
|
}
|