@itentialopensource/adapter-utils 5.10.17 → 5.10.19

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.
@@ -282,7 +282,30 @@ class AuthenticationHandler {
282
282
  }
283
283
 
284
284
  // set up data for first assume role call
285
- const stsrole = new AWS.STS();
285
+ let stsConfigObj;
286
+
287
+ // Add optional config items (ssl, endpoint, proxy)
288
+ if (this.allProps.authentication.aws_sts && this.allProps.authentication.aws_sts.use_proxy_for_initial_auth === true) {
289
+ stsConfigObj = {};
290
+ // Use AWS STS-specific region if available, otherwise fall back to global region
291
+ stsConfigObj.region = this.allProps.authentication.aws_sts.region || this.allProps.region;
292
+ if (this.allProps.authentication.aws_sts.sslEnable === false) {
293
+ stsConfigObj.sslEnabled = false;
294
+ }
295
+ if (this.allProps.authentication.aws_sts.endpoint) {
296
+ stsConfigObj.endpoint = this.allProps.authentication.aws_sts.endpoint;
297
+ }
298
+ if (this.allProps.authentication.aws_sts.proxy) {
299
+ stsConfigObj.httpOptions = {
300
+ proxy: this.allProps.authentication.aws_sts.proxy
301
+ };
302
+ if (this.allProps.authentication.aws_sts.proxyagent) {
303
+ stsConfigObj.httpOptions.agent = this.allProps.authentication.aws_sts.proxyagent;
304
+ }
305
+ }
306
+ }
307
+
308
+ const stsrole = stsConfigObj ? new AWS.STS(stsConfigObj) : new AWS.STS();
286
309
  const stsData = {
287
310
  RoleArn: myRole,
288
311
  RoleSessionName: mySess,
@@ -3106,7 +3106,7 @@ function requestAuthenticate(request, entitySchema, invalidToken, callProperties
3106
3106
  }
3107
3107
 
3108
3108
  // format the authentication string
3109
- log.debug(`${origin}: ${JSON.stringify(propUtilInst.scrubSensitiveInfo(tres, addSensitiveItems))} being used for user: ${useUser}`);
3109
+ log.debug(`${origin}: ${JSON.stringify(propUtilInst.scrubSensitiveInfo(tres, addSensitiveItems))} being used`);
3110
3110
  const authStrs = [];
3111
3111
  if (callProperties && callProperties.authentication && callProperties.authentication.auth_field_format) {
3112
3112
  if (Array.isArray(callProperties.authentication.auth_field_format)) {
@@ -3168,7 +3168,7 @@ function requestAuthenticate(request, entitySchema, invalidToken, callProperties
3168
3168
  return callback(null, errorObj);
3169
3169
  }
3170
3170
 
3171
- log.debug(`${origin}: ${JSON.stringify(propUtilInst.scrubSensitiveInfo(tokenObj, addSensitiveItems))} being used for user: ${useUser}`);
3171
+ log.debug(`${origin}: ${JSON.stringify(propUtilInst.scrubSensitiveInfo(tokenObj, addSensitiveItems))} being used`);
3172
3172
  const authStrs = [];
3173
3173
  if (callProperties && callProperties.authentication && callProperties.authentication.auth_field_format) {
3174
3174
  if (Array.isArray(callProperties.authentication.auth_field_format)) {
@@ -4975,7 +4975,7 @@ class ConnectorRest {
4975
4975
  try {
4976
4976
  if (!throttleEnabled) {
4977
4977
  log.error(`${origin}: Throttling not enabled, no queue`);
4978
- return [];
4978
+ return callback([]);
4979
4979
  }
4980
4980
 
4981
4981
  return throttleEng.getQueue(callback);
package/lib/throttle.js CHANGED
@@ -442,7 +442,12 @@ function gettingCloseInterval(myRequest, transNum, callback) {
442
442
 
443
443
  try {
444
444
  let intRun = false;
445
- const fastInt = (avgTotal / avgSize) * 0.5;
445
+ let fastInt = (avgTotal / avgSize) * 0.5;
446
+
447
+ // prevent timeout overflow errors - 15 min max
448
+ if (fastInt > 900000) {
449
+ fastInt = 900000;
450
+ }
446
451
 
447
452
  // rapid inner interval - should be done when it is almost my time to run.
448
453
  const intervalObject = setInterval(() => {
@@ -1128,6 +1133,11 @@ class SystemXThrottle {
1128
1133
  outerInterval *= 0.95;
1129
1134
  }
1130
1135
 
1136
+ // prevent timeout overflow errors - 2 hours max
1137
+ if (outerInterval > 7200000) {
1138
+ outerInterval = 7200000;
1139
+ }
1140
+
1131
1141
  log.debug(`${origin}: Request ${queueItem.request_id} Transaction ${queueItem.transNum} Outer Interval set to: ${outerInterval}`);
1132
1142
 
1133
1143
  // outer interval to get a turn request
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itentialopensource/adapter-utils",
3
- "version": "5.10.17",
3
+ "version": "5.10.19",
4
4
  "description": "Itential Adapter Utility Libraries",
5
5
  "scripts": {
6
6
  "postinstall": "node utils/setup.js",
@@ -96,10 +96,10 @@
96
96
  "https"
97
97
  ]
98
98
  },
99
- "service" : {
100
- "type" : "string",
99
+ "service": {
100
+ "type": "string",
101
101
  "description": "Service we are integrating with -- used with AWS Authentication",
102
- "examples" : [
102
+ "examples": [
103
103
  "ec2",
104
104
  "route53"
105
105
  ]
@@ -344,7 +344,7 @@
344
344
  "responseFields": {
345
345
  "type": "object",
346
346
  "description": "The fields from the step result"
347
- },
347
+ },
348
348
  "successfullResponseCode": {
349
349
  "type": "integer",
350
350
  "description": "Expected response code for given step, if not set any successfull http response is accepted",
@@ -429,6 +429,11 @@
429
429
  "https",
430
430
  "http"
431
431
  ]
432
+ },
433
+ "use_proxy_for_initial_auth": {
434
+ "type": "boolean",
435
+ "description": "When true, use proxy for initial authentication requests",
436
+ "default": false
432
437
  }
433
438
  }
434
439
  }
@@ -1753,4 +1758,4 @@
1753
1758
  }
1754
1759
  }
1755
1760
  }
1756
- }
1761
+ }