node-opcua-server 2.60.0 → 2.62.2
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/opcua_server.d.ts +1 -1
- package/dist/opcua_server.js +4 -1
- package/dist/opcua_server.js.map +1 -1
- package/dist/register_server_manager.js +5 -2
- package/dist/register_server_manager.js.map +1 -1
- package/dist/server_end_point.js +23 -46
- package/dist/server_end_point.js.map +1 -1
- package/dist/server_engine.js.map +1 -1
- package/package.json +38 -38
- package/source/opcua_server.ts +5 -2
- package/source/register_server_manager.ts +5 -2
- package/source/server_end_point.ts +27 -56
- package/source/server_engine.ts +3 -6
|
@@ -21,7 +21,8 @@ import {
|
|
|
21
21
|
ServerSecureChannelParent,
|
|
22
22
|
toURI,
|
|
23
23
|
AsymmetricAlgorithmSecurityHeader,
|
|
24
|
-
IServerSessionBase
|
|
24
|
+
IServerSessionBase,
|
|
25
|
+
Message
|
|
25
26
|
} from "node-opcua-secure-channel";
|
|
26
27
|
import { UserTokenType } from "node-opcua-service-endpoints";
|
|
27
28
|
import { EndpointDescription } from "node-opcua-service-endpoints";
|
|
@@ -747,7 +748,7 @@ export class OPCUAServerEndPoint extends EventEmitter implements ServerSecureCha
|
|
|
747
748
|
}
|
|
748
749
|
});
|
|
749
750
|
|
|
750
|
-
channel.on("message", (message:
|
|
751
|
+
channel.on("message", (message: Message) => {
|
|
751
752
|
// forward
|
|
752
753
|
this.emit("message", message, channel, this);
|
|
753
754
|
});
|
|
@@ -1001,10 +1002,12 @@ function estimateSecurityLevel(securityMode: MessageSecurityMode, securityPolicy
|
|
|
1001
1002
|
return 4; // deprecated => low
|
|
1002
1003
|
case SecurityPolicy.Basic256Rsa15:
|
|
1003
1004
|
return 4 + offset;
|
|
1005
|
+
case SecurityPolicy.Aes128_Sha256_RsaOaep:
|
|
1006
|
+
return 5 + offset;
|
|
1004
1007
|
case SecurityPolicy.Basic256Sha256:
|
|
1005
1008
|
return 6 + offset;
|
|
1006
|
-
case SecurityPolicy.
|
|
1007
|
-
return
|
|
1009
|
+
case SecurityPolicy.Aes256_Sha256_RsaPss:
|
|
1010
|
+
return 7 + offset;
|
|
1008
1011
|
|
|
1009
1012
|
default:
|
|
1010
1013
|
case SecurityPolicy.None:
|
|
@@ -1047,65 +1050,31 @@ function _makeEndpointDescription(options: MakeEndpointDescriptionOptions): Endp
|
|
|
1047
1050
|
});
|
|
1048
1051
|
}
|
|
1049
1052
|
|
|
1050
|
-
const
|
|
1051
|
-
options.
|
|
1052
|
-
|
|
1053
|
-
if (!onlyCertificateLessConnection) {
|
|
1054
|
-
if (options.securityPolicies.indexOf(SecurityPolicy.Basic256) >= 0) {
|
|
1053
|
+
const a = (tokenType: UserTokenType, securityPolicy: SecurityPolicy, name: string) => {
|
|
1054
|
+
if (options.securityPolicies.indexOf(securityPolicy) >= 0) {
|
|
1055
1055
|
userIdentityTokens.push({
|
|
1056
|
-
policyId: u(
|
|
1057
|
-
tokenType
|
|
1058
|
-
|
|
1056
|
+
policyId: u(name),
|
|
1057
|
+
tokenType,
|
|
1059
1058
|
issuedTokenType: null,
|
|
1060
1059
|
issuerEndpointUrl: null,
|
|
1061
|
-
securityPolicyUri:
|
|
1060
|
+
securityPolicyUri: securityPolicy
|
|
1062
1061
|
});
|
|
1063
1062
|
}
|
|
1063
|
+
};
|
|
1064
|
+
const onlyCertificateLessConnection =
|
|
1065
|
+
options.onlyCertificateLessConnection === undefined ? false : options.onlyCertificateLessConnection;
|
|
1064
1066
|
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
issuedTokenType: null,
|
|
1071
|
-
issuerEndpointUrl: null,
|
|
1072
|
-
securityPolicyUri: SecurityPolicy.Basic128Rsa15
|
|
1073
|
-
});
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
|
-
if (options.securityPolicies.indexOf(SecurityPolicy.Basic256Sha256) >= 0) {
|
|
1077
|
-
userIdentityTokens.push({
|
|
1078
|
-
policyId: u("username_basic256Sha256"),
|
|
1079
|
-
tokenType: UserTokenType.UserName,
|
|
1080
|
-
|
|
1081
|
-
issuedTokenType: null,
|
|
1082
|
-
issuerEndpointUrl: null,
|
|
1083
|
-
securityPolicyUri: SecurityPolicy.Basic256Sha256
|
|
1084
|
-
});
|
|
1085
|
-
}
|
|
1067
|
+
if (!onlyCertificateLessConnection) {
|
|
1068
|
+
a(UserTokenType.UserName, SecurityPolicy.Basic256, "username_basic256");
|
|
1069
|
+
a(UserTokenType.UserName, SecurityPolicy.Basic128Rsa15, "username_basic128Rsa15");
|
|
1070
|
+
a(UserTokenType.UserName, SecurityPolicy.Basic256Sha256, "username_basic256Sha256");
|
|
1071
|
+
a(UserTokenType.UserName, SecurityPolicy.Aes128_Sha256_RsaOaep, "username_aes128Sha256RsaOaep");
|
|
1086
1072
|
|
|
1087
1073
|
// X509
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
issuedTokenType: null,
|
|
1094
|
-
issuerEndpointUrl: null,
|
|
1095
|
-
securityPolicyUri: SecurityPolicy.Basic256
|
|
1096
|
-
});
|
|
1097
|
-
}
|
|
1098
|
-
// Certificate
|
|
1099
|
-
if (options.securityPolicies.indexOf(SecurityPolicy.Basic256Sha256) >= 0) {
|
|
1100
|
-
userIdentityTokens.push({
|
|
1101
|
-
policyId: u("certificate_basic256Sha256"),
|
|
1102
|
-
tokenType: UserTokenType.Certificate,
|
|
1103
|
-
|
|
1104
|
-
issuedTokenType: null,
|
|
1105
|
-
issuerEndpointUrl: null,
|
|
1106
|
-
securityPolicyUri: SecurityPolicy.Basic256Sha256
|
|
1107
|
-
});
|
|
1108
|
-
}
|
|
1074
|
+
a(UserTokenType.Certificate, SecurityPolicy.Basic256, "certificate_basic256");
|
|
1075
|
+
a(UserTokenType.Certificate, SecurityPolicy.Basic128Rsa15, "certificate_basic128Rsa15");
|
|
1076
|
+
a(UserTokenType.Certificate, SecurityPolicy.Basic256Sha256, "certificate_basic256Sha256");
|
|
1077
|
+
a(UserTokenType.Certificate, SecurityPolicy.Aes128_Sha256_RsaOaep, "certificate_aes128Sha256RsaOaep");
|
|
1109
1078
|
}
|
|
1110
1079
|
} else {
|
|
1111
1080
|
// note:
|
|
@@ -1195,5 +1164,7 @@ const defaultSecurityPolicies = [
|
|
|
1195
1164
|
SecurityPolicy.Basic128Rsa15,
|
|
1196
1165
|
SecurityPolicy.Basic256,
|
|
1197
1166
|
// xx UNUSED!! SecurityPolicy.Basic256Rsa15,
|
|
1198
|
-
SecurityPolicy.Basic256Sha256
|
|
1167
|
+
SecurityPolicy.Basic256Sha256,
|
|
1168
|
+
SecurityPolicy.Aes128_Sha256_RsaOaep
|
|
1169
|
+
// NO USED YET SecurityPolicy.Aes256_Sha256_RsaPss
|
|
1199
1170
|
];
|
package/source/server_engine.ts
CHANGED
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
AddressSpace,
|
|
12
12
|
BaseNode,
|
|
13
13
|
bindExtObjArrayNode,
|
|
14
|
-
DataValueCallback,
|
|
15
14
|
ensureDatatypeExtractedWithCallback,
|
|
16
15
|
ensureObjectIsSecure,
|
|
17
16
|
MethodFunctor,
|
|
@@ -473,7 +472,6 @@ export class ServerEngine extends EventEmitter {
|
|
|
473
472
|
this._orphanPublishEngine.shutdown();
|
|
474
473
|
}
|
|
475
474
|
|
|
476
|
-
|
|
477
475
|
for (const token of tokens) {
|
|
478
476
|
this.closeSession(token, true, "Terminated");
|
|
479
477
|
}
|
|
@@ -816,7 +814,7 @@ export class ServerEngine extends EventEmitter {
|
|
|
816
814
|
|
|
817
815
|
// TimeZoneDataType
|
|
818
816
|
const timeZoneDataType = addressSpace.findDataType(resolveNodeId(DataTypeIds.TimeZoneDataType))!;
|
|
819
|
-
|
|
817
|
+
|
|
820
818
|
const timeZone = new TimeZoneDataType({
|
|
821
819
|
daylightSavingInOffset: /* boolean*/ false,
|
|
822
820
|
offset: /* int16 */ 0
|
|
@@ -1079,7 +1077,7 @@ export class ServerEngine extends EventEmitter {
|
|
|
1079
1077
|
});
|
|
1080
1078
|
|
|
1081
1079
|
const namingRuleDataTypeNode = addressSpace.findDataType(resolveNodeId(DataTypeIds.NamingRuleType))! as UADataType;
|
|
1082
|
-
|
|
1080
|
+
|
|
1083
1081
|
if (namingRuleDataTypeNode) {
|
|
1084
1082
|
const namingRuleType = (namingRuleDataTypeNode as any)._getEnumerationInfo().nameIndex; // getEnumeration("NamingRuleType");
|
|
1085
1083
|
if (!namingRuleType) {
|
|
@@ -1908,7 +1906,7 @@ export class ServerEngine extends EventEmitter {
|
|
|
1908
1906
|
// perform all asyncRefresh in parallel
|
|
1909
1907
|
async.map(
|
|
1910
1908
|
objectArray,
|
|
1911
|
-
(obj: BaseNode, inner_callback:
|
|
1909
|
+
(obj: BaseNode, inner_callback: CallbackT<DataValue>) => {
|
|
1912
1910
|
if (obj.nodeClass !== NodeClass.Variable) {
|
|
1913
1911
|
inner_callback(
|
|
1914
1912
|
null,
|
|
@@ -1923,7 +1921,6 @@ export class ServerEngine extends EventEmitter {
|
|
|
1923
1921
|
inner_callback(err, dataValue);
|
|
1924
1922
|
});
|
|
1925
1923
|
} catch (err) {
|
|
1926
|
-
|
|
1927
1924
|
// istanbul ignore next
|
|
1928
1925
|
if (!(err instanceof Error)) {
|
|
1929
1926
|
throw new Error("internal error");
|