@itentialopensource/adapter-utils 5.10.8 → 5.10.9
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/lib/authenticationHandler.js +15 -2
- package/package.json +1 -1
|
@@ -249,6 +249,21 @@ class AuthenticationHandler {
|
|
|
249
249
|
return callback(authOpts.headers);
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
+
const myDate = new Date().getTime();
|
|
253
|
+
const mySess = `${this.myid}-${myDate}`;
|
|
254
|
+
|
|
255
|
+
/* ADAPTER PROPERTIES AUTHENTICATION WITH GLOBAL ROLE */
|
|
256
|
+
// This will use the adapter role via the credentials provided to sign the call. If there is a global role for it to assume.
|
|
257
|
+
// it will use AWS Environment variables (access and secret key are null) to sign the call.
|
|
258
|
+
if (this.allProps.authentication.aws_access_key && this.allProps.authentication.aws_secret_key && this.allProps.authentication.aws_iam_role) {
|
|
259
|
+
log.info('Using Adapter PROPERTIES for AWS Authentication to assume a global role');
|
|
260
|
+
const parmas = {
|
|
261
|
+
RoleArn: this.allProps.authentication.aws_iam_role,
|
|
262
|
+
RoleSessionName: mySess
|
|
263
|
+
};
|
|
264
|
+
return this.assumeAWSSTSRole(null, null, null, options, parmas, true, callback);
|
|
265
|
+
}
|
|
266
|
+
|
|
252
267
|
/* ROLE NAME AUTHENTICATION */
|
|
253
268
|
// Different scenarios to discuss here
|
|
254
269
|
// 1. IAM to internal AWS Server - either Task Role (roleName) or Adapter Role (aws_iam_role)
|
|
@@ -268,8 +283,6 @@ class AuthenticationHandler {
|
|
|
268
283
|
|
|
269
284
|
// set up data for first assume role call
|
|
270
285
|
const stsrole = new AWS.STS();
|
|
271
|
-
const myDate = new Date().getTime();
|
|
272
|
-
const mySess = `${this.myid}-${myDate}`;
|
|
273
286
|
const stsData = {
|
|
274
287
|
RoleArn: myRole,
|
|
275
288
|
RoleSessionName: mySess,
|