@itentialopensource/adapter-utils 4.48.12 → 4.48.14

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/CHANGELOG.md CHANGED
@@ -1,4 +1,22 @@
1
1
 
2
+ ## 4.48.14 [05-09-2023]
3
+
4
+ * modified connectorRest.js so that if there is a field named 'ca_file_content'...
5
+
6
+ Closes ADAPT-2603
7
+
8
+ See merge request itentialopensource/adapter-utils!255
9
+
10
+ ---
11
+
12
+ ## 4.48.13 [04-10-2023]
13
+
14
+ * Update xm2json dependency version in package
15
+
16
+ See merge request itentialopensource/adapter-utils!254
17
+
18
+ ---
19
+
2
20
  ## 4.48.12 [04-06-2023]
3
21
 
4
22
  * Update msa to handle get auth request
@@ -76,6 +76,7 @@ let ecdhAuto = false;
76
76
  let sslEnabled = false;
77
77
  let sslAcceptInvalid = false;
78
78
  let sslCAFile = null;
79
+ let sslCAFileContent = null;
79
80
  let sslKeyFile = null;
80
81
  let sslCertFile = null;
81
82
  let sslCiphers = null;
@@ -1900,7 +1901,11 @@ async function buildTokenRequest(reqPath, reqBody, callProperties, callback) {
1900
1901
  // if we are not accepting invalid certs, need the ca file in the options
1901
1902
  try {
1902
1903
  options.rejectUnauthorized = true;
1903
- options.ca = [fs.readFileSync(callProperties.ssl.ca_file)];
1904
+ if (sslCAFileContent && sslCAFileContent !== '') {
1905
+ options.ca = [sslCAFileContent];
1906
+ } else {
1907
+ options.ca = [fs.readFileSync(callProperties.ssl.ca_file)];
1908
+ }
1904
1909
  } catch (e) {
1905
1910
  const errorObj = this.transUtil.formatErrorObject(origin, 'Missing File', [callProperties.ssl.ca_file], null, null, null);
1906
1911
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
@@ -1925,7 +1930,11 @@ async function buildTokenRequest(reqPath, reqBody, callProperties, callback) {
1925
1930
  // if we are not accepting invalid certs, need the ca file in the options
1926
1931
  try {
1927
1932
  options.rejectUnauthorized = true;
1928
- options.ca = [fs.readFileSync(sslCAFile)];
1933
+ if (sslCAFileContent && sslCAFileContent !== '') {
1934
+ options.ca = [sslCAFileContent];
1935
+ } else {
1936
+ options.ca = [fs.readFileSync(sslCAFile)];
1937
+ }
1929
1938
  } catch (e) {
1930
1939
  const errorObj = this.transUtil.formatErrorObject(origin, 'Missing File', [sslCAFile], null, null, null);
1931
1940
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
@@ -4058,6 +4067,10 @@ class ConnectorRest {
4058
4067
  sslCAFile = props.ssl.ca_file;
4059
4068
  }
4060
4069
 
4070
+ if (typeof props.ssl.ca_file_content === 'string') {
4071
+ sslCAFileContent = props.ssl.ca_file_content;
4072
+ }
4073
+
4061
4074
  // set the ssl key file (optional - default is null)
4062
4075
  if (typeof props.ssl.key_file === 'string') {
4063
4076
  sslKeyFile = props.ssl.key_file;
@@ -4150,7 +4163,7 @@ class ConnectorRest {
4150
4163
  return callback(false);
4151
4164
  }
4152
4165
  }
4153
- if (sslEnabled && !sslAcceptInvalid && !sslCAFile) {
4166
+ if (sslEnabled && !sslAcceptInvalid && (!sslCAFile || !sslCAFileContent)) {
4154
4167
  log.error(`${origin}: FAILED TO LOAD - missing required CA File`);
4155
4168
  return callback(false);
4156
4169
  }
@@ -4194,7 +4207,7 @@ class ConnectorRest {
4194
4207
  return callback(false);
4195
4208
  }
4196
4209
  }
4197
- if (sslEnabled && !sslAcceptInvalid && !sslCAFile) {
4210
+ if (sslEnabled && !sslAcceptInvalid && (!sslCAFile || !sslCAFileContent)) {
4198
4211
  log.error(`${origin}: FAILED TO LOAD - missing required CA File`);
4199
4212
  return callback(false);
4200
4213
  }
@@ -4309,7 +4322,11 @@ class ConnectorRest {
4309
4322
  // if we are not accepting invalid certs, need the ca file in the options
4310
4323
  try {
4311
4324
  options.rejectUnauthorized = true;
4312
- options.ca = [fs.readFileSync(callProperties.ssl.ca_file)];
4325
+ if (sslCAFileContent && sslCAFileContent !== '') {
4326
+ options.ca = [sslCAFileContent];
4327
+ } else {
4328
+ options.ca = [fs.readFileSync(callProperties.ssl.ca_file)];
4329
+ }
4313
4330
  } catch (e) {
4314
4331
  const errorObj = this.transUtil.formatErrorObject(origin, 'Missing File', [callProperties.ssl.ca_file], null, null, null);
4315
4332
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
@@ -4334,7 +4351,11 @@ class ConnectorRest {
4334
4351
  // if we are not accepting invalid certs, need the ca file in the options
4335
4352
  try {
4336
4353
  options.rejectUnauthorized = true;
4337
- options.ca = [fs.readFileSync(sslCAFile)];
4354
+ if (sslCAFileContent && sslCAFileContent !== '') {
4355
+ options.ca = [sslCAFileContent];
4356
+ } else {
4357
+ options.ca = [fs.readFileSync(sslCAFile)];
4358
+ }
4338
4359
  } catch (e) {
4339
4360
  const errorObj = this.transUtil.formatErrorObject(origin, 'Missing File', [sslCAFile], null, null, null);
4340
4361
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
@@ -4496,7 +4517,11 @@ class ConnectorRest {
4496
4517
  // if we are not accepting invalid certs, need the ca file in the options
4497
4518
  try {
4498
4519
  options.rejectUnauthorized = true;
4499
- options.ca = [fs.readFileSync(callProperties.ssl.ca_file)];
4520
+ if (sslCAFileContent && sslCAFileContent !== '') {
4521
+ options.ca = [sslCAFileContent];
4522
+ } else {
4523
+ options.ca = [fs.readFileSync(callProperties.ssl.ca_file)];
4524
+ }
4500
4525
  } catch (e) {
4501
4526
  const errorObj = this.transUtil.formatErrorObject(origin, 'Missing File', [callProperties.ssl.ca_file], null, null, null);
4502
4527
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
@@ -4521,7 +4546,11 @@ class ConnectorRest {
4521
4546
  // if we are not accepting invalid certs, need the ca file in the options
4522
4547
  try {
4523
4548
  options.rejectUnauthorized = true;
4524
- options.ca = [fs.readFileSync(sslCAFile)];
4549
+ if (sslCAFileContent && sslCAFileContent !== '') {
4550
+ options.ca = [sslCAFileContent];
4551
+ } else {
4552
+ options.ca = [fs.readFileSync(sslCAFile)];
4553
+ }
4525
4554
  } catch (e) {
4526
4555
  const errorObj = this.transUtil.formatErrorObject(origin, 'Missing File', [sslCAFile], null, null, null);
4527
4556
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itentialopensource/adapter-utils",
3
- "version": "4.48.12",
3
+ "version": "4.48.14",
4
4
  "description": "Itential Adapter Utility Libraries",
5
5
  "scripts": {
6
6
  "postinstall": "node utils/setup.js",
@@ -41,7 +41,7 @@
41
41
  "readline-sync": "^1.4.10",
42
42
  "socks-proxy-agent": "^4.0.2",
43
43
  "uuid": "^8.3.2",
44
- "xml2js": "^0.4.23"
44
+ "xml2js": "^0.5.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "chai": "^4.3.4",
@@ -50,12 +50,12 @@
50
50
  "eslint-plugin-import": "^2.23.4",
51
51
  "eslint-plugin-json": "^3.0.0",
52
52
  "mocha": "^9.0.1",
53
+ "nock": "^13.2.9",
53
54
  "nyc": "^15.1.0",
54
55
  "strip-ansi": "^7.0.1",
55
56
  "strip-ansi-cli": "^3.0.1",
56
57
  "testdouble": "^3.16.1",
57
- "winston": "^3.3.3",
58
- "nock": "^13.2.9"
58
+ "winston": "^3.3.3"
59
59
  },
60
60
  "peerDependencies": {},
61
61
  "private": false