@digipair/skill-s3 0.136.3 → 0.136.5
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/AwsRestJsonProtocol.esm.js +208 -123
- package/dist/externalDataInterceptor.esm.js +1 -1
- package/dist/getSSOTokenFromFile.esm.js +4 -4
- package/dist/index.esm.js +10 -8
- package/dist/index.esm10.js +81 -89
- package/dist/index.esm11.js +659 -420
- package/dist/index.esm12.js +231 -1138
- package/dist/index.esm13.js +896 -1600
- package/dist/index.esm14.js +210 -0
- package/dist/index.esm15.js +4780 -0
- package/dist/index.esm16.js +2057 -0
- package/dist/index.esm17.js +434 -0
- package/dist/index.esm18.js +1265 -0
- package/dist/index.esm19.js +456 -0
- package/dist/index.esm2.js +58503 -11
- package/dist/index.esm20.js +4885 -0
- package/dist/index.esm3.js +787 -51789
- package/dist/index.esm4.js +1154 -88
- package/dist/index.esm5.js +268 -4827
- package/dist/index.esm6.js +954 -951
- package/dist/index.esm7.js +2425 -119
- package/dist/index.esm8.js +124 -426
- package/dist/index.esm9.js +123 -2399
- package/dist/loadSso.esm.js +4966 -187
- package/dist/loadSso.esm2.js +6584 -0
- package/dist/{package.esm.js → loadSsoSessionData.esm.js} +155 -122
- package/dist/noAuth.esm.js +165 -0
- package/dist/parseKnownFiles.esm.js +1 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/lib/skill-s3.d.ts +6 -0
- package/dist/src/lib/skill-s3.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/create-aggregated-client.esm.js +0 -366
package/dist/index.esm9.js
CHANGED
|
@@ -1,255 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { readFileSync } from 'fs';
|
|
2
|
+
import { e as externalDataInterceptor } from './externalDataInterceptor.esm.js';
|
|
3
|
+
import { s as setCredentialFeature, C as CredentialsProviderError } from './index.esm2.js';
|
|
4
|
+
import './getSSOTokenFromFile.esm.js';
|
|
5
|
+
import 'fs/promises';
|
|
6
|
+
import 'crypto';
|
|
7
|
+
import 'path';
|
|
8
|
+
import 'buffer';
|
|
9
|
+
import 'os';
|
|
7
10
|
import 'node:fs/promises';
|
|
11
|
+
import 'stream';
|
|
8
12
|
import 'node:stream';
|
|
9
|
-
import '
|
|
10
|
-
import '
|
|
11
|
-
import '
|
|
12
|
-
import 'node:
|
|
13
|
-
|
|
14
|
-
function asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, key, arg) {
|
|
15
|
-
try {
|
|
16
|
-
var info = gen[key](arg);
|
|
17
|
-
var value = info.value;
|
|
18
|
-
} catch (error) {
|
|
19
|
-
reject(error);
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
if (info.done) {
|
|
23
|
-
resolve(value);
|
|
24
|
-
} else {
|
|
25
|
-
Promise.resolve(value).then(_next, _throw);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
function _async_to_generator$a(fn) {
|
|
29
|
-
return function() {
|
|
30
|
-
var self = this, args = arguments;
|
|
31
|
-
return new Promise(function(resolve, reject) {
|
|
32
|
-
var gen = fn.apply(self, args);
|
|
33
|
-
function _next(value) {
|
|
34
|
-
asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, "next", value);
|
|
35
|
-
}
|
|
36
|
-
function _throw(err) {
|
|
37
|
-
asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, "throw", err);
|
|
38
|
-
}
|
|
39
|
-
_next(undefined);
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
function _ts_generator$a(thisArg, body) {
|
|
44
|
-
var f, y, t, g, _ = {
|
|
45
|
-
label: 0,
|
|
46
|
-
sent: function() {
|
|
47
|
-
if (t[0] & 1) throw t[1];
|
|
48
|
-
return t[1];
|
|
49
|
-
},
|
|
50
|
-
trys: [],
|
|
51
|
-
ops: []
|
|
52
|
-
};
|
|
53
|
-
return g = {
|
|
54
|
-
next: verb(0),
|
|
55
|
-
"throw": verb(1),
|
|
56
|
-
"return": verb(2)
|
|
57
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
58
|
-
return this;
|
|
59
|
-
}), g;
|
|
60
|
-
function verb(n) {
|
|
61
|
-
return function(v) {
|
|
62
|
-
return step([
|
|
63
|
-
n,
|
|
64
|
-
v
|
|
65
|
-
]);
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
function step(op) {
|
|
69
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
70
|
-
while(_)try {
|
|
71
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
72
|
-
if (y = 0, t) op = [
|
|
73
|
-
op[0] & 2,
|
|
74
|
-
t.value
|
|
75
|
-
];
|
|
76
|
-
switch(op[0]){
|
|
77
|
-
case 0:
|
|
78
|
-
case 1:
|
|
79
|
-
t = op;
|
|
80
|
-
break;
|
|
81
|
-
case 4:
|
|
82
|
-
_.label++;
|
|
83
|
-
return {
|
|
84
|
-
value: op[1],
|
|
85
|
-
done: false
|
|
86
|
-
};
|
|
87
|
-
case 5:
|
|
88
|
-
_.label++;
|
|
89
|
-
y = op[1];
|
|
90
|
-
op = [
|
|
91
|
-
0
|
|
92
|
-
];
|
|
93
|
-
continue;
|
|
94
|
-
case 7:
|
|
95
|
-
op = _.ops.pop();
|
|
96
|
-
_.trys.pop();
|
|
97
|
-
continue;
|
|
98
|
-
default:
|
|
99
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
100
|
-
_ = 0;
|
|
101
|
-
continue;
|
|
102
|
-
}
|
|
103
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
104
|
-
_.label = op[1];
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
108
|
-
_.label = t[1];
|
|
109
|
-
t = op;
|
|
110
|
-
break;
|
|
111
|
-
}
|
|
112
|
-
if (t && _.label < t[2]) {
|
|
113
|
-
_.label = t[2];
|
|
114
|
-
_.ops.push(op);
|
|
115
|
-
break;
|
|
116
|
-
}
|
|
117
|
-
if (t[2]) _.ops.pop();
|
|
118
|
-
_.trys.pop();
|
|
119
|
-
continue;
|
|
120
|
-
}
|
|
121
|
-
op = body.call(thisArg, _);
|
|
122
|
-
} catch (e) {
|
|
123
|
-
op = [
|
|
124
|
-
6,
|
|
125
|
-
e
|
|
126
|
-
];
|
|
127
|
-
y = 0;
|
|
128
|
-
} finally{
|
|
129
|
-
f = t = 0;
|
|
130
|
-
}
|
|
131
|
-
if (op[0] & 5) throw op[1];
|
|
132
|
-
return {
|
|
133
|
-
value: op[0] ? op[1] : void 0,
|
|
134
|
-
done: true
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
var resolveCredentialSource = function(credentialSource, profileName, logger) {
|
|
139
|
-
var sourceProvidersMap = {
|
|
140
|
-
EcsContainer: function() {
|
|
141
|
-
var _ref = _async_to_generator$a(function(options) {
|
|
142
|
-
var fromHttp, fromContainerMetadata;
|
|
143
|
-
return _ts_generator$a(this, function(_state) {
|
|
144
|
-
switch(_state.label){
|
|
145
|
-
case 0:
|
|
146
|
-
return [
|
|
147
|
-
4,
|
|
148
|
-
import('./index.esm8.js')
|
|
149
|
-
];
|
|
150
|
-
case 1:
|
|
151
|
-
fromHttp = _state.sent().fromHttp;
|
|
152
|
-
return [
|
|
153
|
-
4,
|
|
154
|
-
import('./index.esm10.js')
|
|
155
|
-
];
|
|
156
|
-
case 2:
|
|
157
|
-
fromContainerMetadata = _state.sent().fromContainerMetadata;
|
|
158
|
-
logger === null || logger === void 0 ? void 0 : logger.debug("@aws-sdk/credential-provider-ini - credential_source is EcsContainer");
|
|
159
|
-
return [
|
|
160
|
-
2,
|
|
161
|
-
/*#__PURE__*/ _async_to_generator$a(function() {
|
|
162
|
-
return _ts_generator$a(this, function(_state) {
|
|
163
|
-
return [
|
|
164
|
-
2,
|
|
165
|
-
chain(fromHttp(options !== null && options !== void 0 ? options : {}), fromContainerMetadata(options))().then(setNamedProvider)
|
|
166
|
-
];
|
|
167
|
-
});
|
|
168
|
-
})
|
|
169
|
-
];
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
return function(options) {
|
|
174
|
-
return _ref.apply(this, arguments);
|
|
175
|
-
};
|
|
176
|
-
}(),
|
|
177
|
-
Ec2InstanceMetadata: function() {
|
|
178
|
-
var _ref = _async_to_generator$a(function(options) {
|
|
179
|
-
var fromInstanceMetadata;
|
|
180
|
-
return _ts_generator$a(this, function(_state) {
|
|
181
|
-
switch(_state.label){
|
|
182
|
-
case 0:
|
|
183
|
-
logger === null || logger === void 0 ? void 0 : logger.debug("@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata");
|
|
184
|
-
return [
|
|
185
|
-
4,
|
|
186
|
-
import('./index.esm10.js')
|
|
187
|
-
];
|
|
188
|
-
case 1:
|
|
189
|
-
fromInstanceMetadata = _state.sent().fromInstanceMetadata;
|
|
190
|
-
return [
|
|
191
|
-
2,
|
|
192
|
-
/*#__PURE__*/ _async_to_generator$a(function() {
|
|
193
|
-
return _ts_generator$a(this, function(_state) {
|
|
194
|
-
return [
|
|
195
|
-
2,
|
|
196
|
-
fromInstanceMetadata(options)().then(setNamedProvider)
|
|
197
|
-
];
|
|
198
|
-
});
|
|
199
|
-
})
|
|
200
|
-
];
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
});
|
|
204
|
-
return function(options) {
|
|
205
|
-
return _ref.apply(this, arguments);
|
|
206
|
-
};
|
|
207
|
-
}(),
|
|
208
|
-
Environment: function() {
|
|
209
|
-
var _ref = _async_to_generator$a(function(options) {
|
|
210
|
-
var fromEnv;
|
|
211
|
-
return _ts_generator$a(this, function(_state) {
|
|
212
|
-
switch(_state.label){
|
|
213
|
-
case 0:
|
|
214
|
-
logger === null || logger === void 0 ? void 0 : logger.debug("@aws-sdk/credential-provider-ini - credential_source is Environment");
|
|
215
|
-
return [
|
|
216
|
-
4,
|
|
217
|
-
import('./index.esm2.js')
|
|
218
|
-
];
|
|
219
|
-
case 1:
|
|
220
|
-
fromEnv = _state.sent().fromEnv;
|
|
221
|
-
return [
|
|
222
|
-
2,
|
|
223
|
-
/*#__PURE__*/ _async_to_generator$a(function() {
|
|
224
|
-
return _ts_generator$a(this, function(_state) {
|
|
225
|
-
return [
|
|
226
|
-
2,
|
|
227
|
-
fromEnv(options)().then(setNamedProvider)
|
|
228
|
-
];
|
|
229
|
-
});
|
|
230
|
-
})
|
|
231
|
-
];
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
});
|
|
235
|
-
return function(options) {
|
|
236
|
-
return _ref.apply(this, arguments);
|
|
237
|
-
};
|
|
238
|
-
}()
|
|
239
|
-
};
|
|
240
|
-
if (credentialSource in sourceProvidersMap) {
|
|
241
|
-
return sourceProvidersMap[credentialSource];
|
|
242
|
-
} else {
|
|
243
|
-
throw new CredentialsProviderError("Unsupported credential source in profile ".concat(profileName, ". Got ").concat(credentialSource, ", ") + "expected EcsContainer or Ec2InstanceMetadata or Environment.", {
|
|
244
|
-
logger: logger
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
var setNamedProvider = function(creds) {
|
|
249
|
-
return setCredentialFeature(creds, "CREDENTIALS_PROFILE_NAMED_PROVIDER", "p");
|
|
250
|
-
};
|
|
13
|
+
import 'http';
|
|
14
|
+
import 'https';
|
|
15
|
+
import 'process';
|
|
16
|
+
import 'node:fs';
|
|
17
|
+
import 'zlib';
|
|
251
18
|
|
|
252
|
-
function asyncGeneratorStep$
|
|
19
|
+
function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
|
|
253
20
|
try {
|
|
254
21
|
var info = gen[key](arg);
|
|
255
22
|
var value = info.value;
|
|
@@ -263,22 +30,22 @@ function asyncGeneratorStep$9(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
263
30
|
Promise.resolve(value).then(_next, _throw);
|
|
264
31
|
}
|
|
265
32
|
}
|
|
266
|
-
function _async_to_generator$
|
|
33
|
+
function _async_to_generator$1(fn) {
|
|
267
34
|
return function() {
|
|
268
35
|
var self = this, args = arguments;
|
|
269
36
|
return new Promise(function(resolve, reject) {
|
|
270
37
|
var gen = fn.apply(self, args);
|
|
271
38
|
function _next(value) {
|
|
272
|
-
asyncGeneratorStep$
|
|
39
|
+
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
|
|
273
40
|
}
|
|
274
41
|
function _throw(err) {
|
|
275
|
-
asyncGeneratorStep$
|
|
42
|
+
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
|
|
276
43
|
}
|
|
277
44
|
_next(undefined);
|
|
278
45
|
});
|
|
279
46
|
};
|
|
280
47
|
}
|
|
281
|
-
function _define_property$
|
|
48
|
+
function _define_property$1(obj, key, value) {
|
|
282
49
|
if (key in obj) {
|
|
283
50
|
Object.defineProperty(obj, key, {
|
|
284
51
|
value: value,
|
|
@@ -291,7 +58,7 @@ function _define_property$4(obj, key, value) {
|
|
|
291
58
|
}
|
|
292
59
|
return obj;
|
|
293
60
|
}
|
|
294
|
-
function _object_spread$
|
|
61
|
+
function _object_spread$1(target) {
|
|
295
62
|
for(var i = 1; i < arguments.length; i++){
|
|
296
63
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
297
64
|
var ownKeys = Object.keys(source);
|
|
@@ -301,12 +68,12 @@ function _object_spread$4(target) {
|
|
|
301
68
|
}));
|
|
302
69
|
}
|
|
303
70
|
ownKeys.forEach(function(key) {
|
|
304
|
-
_define_property$
|
|
71
|
+
_define_property$1(target, key, source[key]);
|
|
305
72
|
});
|
|
306
73
|
}
|
|
307
74
|
return target;
|
|
308
75
|
}
|
|
309
|
-
function ownKeys$
|
|
76
|
+
function ownKeys$1(object, enumerableOnly) {
|
|
310
77
|
var keys = Object.keys(object);
|
|
311
78
|
if (Object.getOwnPropertySymbols) {
|
|
312
79
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
@@ -314,22 +81,18 @@ function ownKeys$3(object, enumerableOnly) {
|
|
|
314
81
|
}
|
|
315
82
|
return keys;
|
|
316
83
|
}
|
|
317
|
-
function _object_spread_props$
|
|
84
|
+
function _object_spread_props$1(target, source) {
|
|
318
85
|
source = source != null ? source : {};
|
|
319
86
|
if (Object.getOwnPropertyDescriptors) {
|
|
320
87
|
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
321
88
|
} else {
|
|
322
|
-
ownKeys$
|
|
89
|
+
ownKeys$1(Object(source)).forEach(function(key) {
|
|
323
90
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
324
91
|
});
|
|
325
92
|
}
|
|
326
93
|
return target;
|
|
327
94
|
}
|
|
328
|
-
function
|
|
329
|
-
"@swc/helpers - typeof";
|
|
330
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
331
|
-
}
|
|
332
|
-
function _ts_generator$9(thisArg, body) {
|
|
95
|
+
function _ts_generator$1(thisArg, body) {
|
|
333
96
|
var f, y, t, g, _ = {
|
|
334
97
|
label: 0,
|
|
335
98
|
sent: function() {
|
|
@@ -424,162 +187,54 @@ function _ts_generator$9(thisArg, body) {
|
|
|
424
187
|
};
|
|
425
188
|
}
|
|
426
189
|
}
|
|
427
|
-
var
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
var _arguments = arguments;
|
|
468
|
-
return _ts_generator$9(this, function(_state) {
|
|
469
|
-
switch(_state.label){
|
|
470
|
-
case 0:
|
|
471
|
-
visitedProfiles = _arguments.length > 4 && _arguments[4] !== void 0 ? _arguments[4] : {}, resolveProfileData = _arguments.length > 5 ? _arguments[5] : void 0;
|
|
472
|
-
(_options_logger = options.logger) === null || _options_logger === void 0 ? void 0 : _options_logger.debug("@aws-sdk/credential-provider-ini - resolveAssumeRoleCredentials (STS)");
|
|
473
|
-
profileData = profiles[profileName];
|
|
474
|
-
source_profile = profileData.source_profile, region = profileData.region;
|
|
475
|
-
if (!!options.roleAssumer) return [
|
|
476
|
-
3,
|
|
477
|
-
2
|
|
478
|
-
];
|
|
479
|
-
return [
|
|
480
|
-
4,
|
|
481
|
-
import('./index.esm5.js')
|
|
482
|
-
];
|
|
483
|
-
case 1:
|
|
484
|
-
getDefaultRoleAssumer = _state.sent().getDefaultRoleAssumer;
|
|
485
|
-
options.roleAssumer = getDefaultRoleAssumer(_object_spread_props$3(_object_spread$4({}, options.clientConfig), {
|
|
486
|
-
credentialProviderLogger: options.logger,
|
|
487
|
-
parentClientConfig: _object_spread_props$3(_object_spread$4({}, callerClientConfig, options === null || options === void 0 ? void 0 : options.parentClientConfig), {
|
|
488
|
-
region: (_ref = region !== null && region !== void 0 ? region : options === null || options === void 0 ? void 0 : (_options_parentClientConfig = options.parentClientConfig) === null || _options_parentClientConfig === void 0 ? void 0 : _options_parentClientConfig.region) !== null && _ref !== void 0 ? _ref : callerClientConfig === null || callerClientConfig === void 0 ? void 0 : callerClientConfig.region
|
|
489
|
-
})
|
|
490
|
-
}), options.clientPlugins);
|
|
491
|
-
_state.label = 2;
|
|
492
|
-
case 2:
|
|
493
|
-
if (source_profile && source_profile in visitedProfiles) {
|
|
494
|
-
throw new CredentialsProviderError("Detected a cycle attempting to resolve credentials for profile" + " ".concat(getProfileName(options), ". Profiles visited: ") + Object.keys(visitedProfiles).join(", "), {
|
|
495
|
-
logger: options.logger
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
(_options_logger1 = options.logger) === null || _options_logger1 === void 0 ? void 0 : _options_logger1.debug("@aws-sdk/credential-provider-ini - finding credential resolver using ".concat(source_profile ? "source_profile=[".concat(source_profile, "]") : "profile=[".concat(profileName, "]")));
|
|
499
|
-
if (!source_profile) return [
|
|
500
|
-
3,
|
|
501
|
-
3
|
|
502
|
-
];
|
|
503
|
-
_tmp = resolveProfileData(source_profile, profiles, options, callerClientConfig, _object_spread_props$3(_object_spread$4({}, visitedProfiles), _define_property$4({}, source_profile, true)), isCredentialSourceWithoutRoleArn((_profiles_source_profile = profiles[source_profile]) !== null && _profiles_source_profile !== void 0 ? _profiles_source_profile : {}));
|
|
504
|
-
return [
|
|
505
|
-
3,
|
|
506
|
-
5
|
|
507
|
-
];
|
|
508
|
-
case 3:
|
|
509
|
-
return [
|
|
510
|
-
4,
|
|
511
|
-
resolveCredentialSource(profileData.credential_source, profileName, options.logger)(options)
|
|
512
|
-
];
|
|
513
|
-
case 4:
|
|
514
|
-
_tmp = _state.sent()();
|
|
515
|
-
_state.label = 5;
|
|
516
|
-
case 5:
|
|
517
|
-
sourceCredsProvider = _tmp;
|
|
518
|
-
if (!isCredentialSourceWithoutRoleArn(profileData)) return [
|
|
519
|
-
3,
|
|
520
|
-
6
|
|
521
|
-
];
|
|
522
|
-
return [
|
|
523
|
-
2,
|
|
524
|
-
sourceCredsProvider.then(function(creds) {
|
|
525
|
-
return setCredentialFeature(creds, "CREDENTIALS_PROFILE_SOURCE_PROFILE", "o");
|
|
526
|
-
})
|
|
527
|
-
];
|
|
528
|
-
case 6:
|
|
529
|
-
params = {
|
|
530
|
-
RoleArn: profileData.role_arn,
|
|
531
|
-
RoleSessionName: profileData.role_session_name || "aws-sdk-js-".concat(Date.now()),
|
|
532
|
-
ExternalId: profileData.external_id,
|
|
533
|
-
DurationSeconds: parseInt(profileData.duration_seconds || "3600", 10)
|
|
534
|
-
};
|
|
535
|
-
mfa_serial = profileData.mfa_serial;
|
|
536
|
-
if (!mfa_serial) return [
|
|
537
|
-
3,
|
|
538
|
-
8
|
|
539
|
-
];
|
|
540
|
-
if (!options.mfaCodeProvider) {
|
|
541
|
-
throw new CredentialsProviderError("Profile ".concat(profileName, " requires multi-factor authentication, but no MFA code callback was provided."), {
|
|
542
|
-
logger: options.logger,
|
|
543
|
-
tryNextLink: false
|
|
544
|
-
});
|
|
545
|
-
}
|
|
546
|
-
params.SerialNumber = mfa_serial;
|
|
547
|
-
return [
|
|
548
|
-
4,
|
|
549
|
-
options.mfaCodeProvider(mfa_serial)
|
|
550
|
-
];
|
|
551
|
-
case 7:
|
|
552
|
-
params.TokenCode = _state.sent();
|
|
553
|
-
_state.label = 8;
|
|
554
|
-
case 8:
|
|
555
|
-
return [
|
|
556
|
-
4,
|
|
557
|
-
sourceCredsProvider
|
|
558
|
-
];
|
|
559
|
-
case 9:
|
|
560
|
-
sourceCreds = _state.sent();
|
|
561
|
-
return [
|
|
562
|
-
2,
|
|
563
|
-
options.roleAssumer(sourceCreds, params).then(function(creds) {
|
|
564
|
-
return setCredentialFeature(creds, "CREDENTIALS_PROFILE_SOURCE_PROFILE", "o");
|
|
565
|
-
})
|
|
566
|
-
];
|
|
567
|
-
case 10:
|
|
568
|
-
return [
|
|
569
|
-
2
|
|
570
|
-
];
|
|
571
|
-
}
|
|
190
|
+
var fromWebToken = function(init) {
|
|
191
|
+
return function() {
|
|
192
|
+
var _ref = _async_to_generator$1(function(awsIdentityProperties) {
|
|
193
|
+
var _init_logger, roleArn, roleSessionName, webIdentityToken, providerId, policyArns, policy, durationSeconds, roleAssumerWithWebIdentity, getDefaultRoleAssumerWithWebIdentity;
|
|
194
|
+
return _ts_generator$1(this, function(_state) {
|
|
195
|
+
switch(_state.label){
|
|
196
|
+
case 0:
|
|
197
|
+
(_init_logger = init.logger) === null || _init_logger === void 0 ? void 0 : _init_logger.debug("@aws-sdk/credential-provider-web-identity - fromWebToken");
|
|
198
|
+
roleArn = init.roleArn, roleSessionName = init.roleSessionName, webIdentityToken = init.webIdentityToken, providerId = init.providerId, policyArns = init.policyArns, policy = init.policy, durationSeconds = init.durationSeconds;
|
|
199
|
+
roleAssumerWithWebIdentity = init.roleAssumerWithWebIdentity;
|
|
200
|
+
if (!!roleAssumerWithWebIdentity) return [
|
|
201
|
+
3,
|
|
202
|
+
2
|
|
203
|
+
];
|
|
204
|
+
return [
|
|
205
|
+
4,
|
|
206
|
+
import('./index.esm15.js')
|
|
207
|
+
];
|
|
208
|
+
case 1:
|
|
209
|
+
getDefaultRoleAssumerWithWebIdentity = _state.sent().getDefaultRoleAssumerWithWebIdentity;
|
|
210
|
+
roleAssumerWithWebIdentity = getDefaultRoleAssumerWithWebIdentity(_object_spread_props$1(_object_spread$1({}, init.clientConfig), {
|
|
211
|
+
credentialProviderLogger: init.logger,
|
|
212
|
+
parentClientConfig: _object_spread$1({}, awsIdentityProperties === null || awsIdentityProperties === void 0 ? void 0 : awsIdentityProperties.callerClientConfig, init.parentClientConfig)
|
|
213
|
+
}), init.clientPlugins);
|
|
214
|
+
_state.label = 2;
|
|
215
|
+
case 2:
|
|
216
|
+
return [
|
|
217
|
+
2,
|
|
218
|
+
roleAssumerWithWebIdentity({
|
|
219
|
+
RoleArn: roleArn,
|
|
220
|
+
RoleSessionName: roleSessionName !== null && roleSessionName !== void 0 ? roleSessionName : "aws-sdk-js-session-".concat(Date.now()),
|
|
221
|
+
WebIdentityToken: webIdentityToken,
|
|
222
|
+
ProviderId: providerId,
|
|
223
|
+
PolicyArns: policyArns,
|
|
224
|
+
Policy: policy,
|
|
225
|
+
DurationSeconds: durationSeconds
|
|
226
|
+
})
|
|
227
|
+
];
|
|
228
|
+
}
|
|
229
|
+
});
|
|
572
230
|
});
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
};
|
|
577
|
-
}();
|
|
578
|
-
var isCredentialSourceWithoutRoleArn = function(section) {
|
|
579
|
-
return !section.role_arn && !!section.credential_source;
|
|
231
|
+
return function(awsIdentityProperties) {
|
|
232
|
+
return _ref.apply(this, arguments);
|
|
233
|
+
};
|
|
234
|
+
}();
|
|
580
235
|
};
|
|
581
236
|
|
|
582
|
-
function asyncGeneratorStep
|
|
237
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
583
238
|
try {
|
|
584
239
|
var info = gen[key](arg);
|
|
585
240
|
var value = info.value;
|
|
@@ -593,40 +248,22 @@ function asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
593
248
|
Promise.resolve(value).then(_next, _throw);
|
|
594
249
|
}
|
|
595
250
|
}
|
|
596
|
-
function _async_to_generator
|
|
251
|
+
function _async_to_generator(fn) {
|
|
597
252
|
return function() {
|
|
598
253
|
var self = this, args = arguments;
|
|
599
254
|
return new Promise(function(resolve, reject) {
|
|
600
255
|
var gen = fn.apply(self, args);
|
|
601
256
|
function _next(value) {
|
|
602
|
-
asyncGeneratorStep
|
|
257
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
603
258
|
}
|
|
604
259
|
function _throw(err) {
|
|
605
|
-
asyncGeneratorStep
|
|
260
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
606
261
|
}
|
|
607
262
|
_next(undefined);
|
|
608
263
|
});
|
|
609
264
|
};
|
|
610
265
|
}
|
|
611
|
-
function
|
|
612
|
-
if (!(instance instanceof Constructor)) {
|
|
613
|
-
throw new TypeError("Cannot call a class as a function");
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
function _defineProperties(target, props) {
|
|
617
|
-
for(var i = 0; i < props.length; i++){
|
|
618
|
-
var descriptor = props[i];
|
|
619
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
620
|
-
descriptor.configurable = true;
|
|
621
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
622
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
626
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
627
|
-
return Constructor;
|
|
628
|
-
}
|
|
629
|
-
function _define_property$3(obj, key, value) {
|
|
266
|
+
function _define_property(obj, key, value) {
|
|
630
267
|
if (key in obj) {
|
|
631
268
|
Object.defineProperty(obj, key, {
|
|
632
269
|
value: value,
|
|
@@ -639,14 +276,7 @@ function _define_property$3(obj, key, value) {
|
|
|
639
276
|
}
|
|
640
277
|
return obj;
|
|
641
278
|
}
|
|
642
|
-
function
|
|
643
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
644
|
-
return !!right[Symbol.hasInstance](left);
|
|
645
|
-
} else {
|
|
646
|
-
return left instanceof right;
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
function _object_spread$3(target) {
|
|
279
|
+
function _object_spread(target) {
|
|
650
280
|
for(var i = 1; i < arguments.length; i++){
|
|
651
281
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
652
282
|
var ownKeys = Object.keys(source);
|
|
@@ -656,12 +286,12 @@ function _object_spread$3(target) {
|
|
|
656
286
|
}));
|
|
657
287
|
}
|
|
658
288
|
ownKeys.forEach(function(key) {
|
|
659
|
-
_define_property
|
|
289
|
+
_define_property(target, key, source[key]);
|
|
660
290
|
});
|
|
661
291
|
}
|
|
662
292
|
return target;
|
|
663
293
|
}
|
|
664
|
-
function ownKeys
|
|
294
|
+
function ownKeys(object, enumerableOnly) {
|
|
665
295
|
var keys = Object.keys(object);
|
|
666
296
|
if (Object.getOwnPropertySymbols) {
|
|
667
297
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
@@ -669,18 +299,18 @@ function ownKeys$2(object, enumerableOnly) {
|
|
|
669
299
|
}
|
|
670
300
|
return keys;
|
|
671
301
|
}
|
|
672
|
-
function _object_spread_props
|
|
302
|
+
function _object_spread_props(target, source) {
|
|
673
303
|
source = source != null ? source : {};
|
|
674
304
|
if (Object.getOwnPropertyDescriptors) {
|
|
675
305
|
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
676
306
|
} else {
|
|
677
|
-
ownKeys
|
|
307
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
678
308
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
679
309
|
});
|
|
680
310
|
}
|
|
681
311
|
return target;
|
|
682
312
|
}
|
|
683
|
-
function _ts_generator
|
|
313
|
+
function _ts_generator(thisArg, body) {
|
|
684
314
|
var f, y, t, g, _ = {
|
|
685
315
|
label: 0,
|
|
686
316
|
sent: function() {
|
|
@@ -775,1958 +405,52 @@ function _ts_generator$8(thisArg, body) {
|
|
|
775
405
|
};
|
|
776
406
|
}
|
|
777
407
|
}
|
|
778
|
-
var
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
case 0:
|
|
798
|
-
return [
|
|
799
|
-
4,
|
|
800
|
-
_this.loadToken()
|
|
801
|
-
];
|
|
802
|
-
case 1:
|
|
803
|
-
token = _state.sent();
|
|
804
|
-
if (!token) {
|
|
805
|
-
throw new CredentialsProviderError("Failed to load a token for session ".concat(_this.loginSession, ", please re-authenticate using aws login"), {
|
|
806
|
-
tryNextLink: false,
|
|
807
|
-
logger: _this.logger
|
|
808
|
-
});
|
|
809
|
-
}
|
|
810
|
-
accessToken = token.accessToken;
|
|
811
|
-
now = Date.now();
|
|
812
|
-
expiryTime = new Date(accessToken.expiresAt).getTime();
|
|
813
|
-
timeUntilExpiry = expiryTime - now;
|
|
814
|
-
if (timeUntilExpiry <= LoginCredentialsFetcher.REFRESH_THRESHOLD) {
|
|
815
|
-
return [
|
|
816
|
-
2,
|
|
817
|
-
_this.refresh(token)
|
|
818
|
-
];
|
|
819
|
-
}
|
|
820
|
-
return [
|
|
821
|
-
2,
|
|
822
|
-
{
|
|
823
|
-
accessKeyId: accessToken.accessKeyId,
|
|
824
|
-
secretAccessKey: accessToken.secretAccessKey,
|
|
825
|
-
sessionToken: accessToken.sessionToken,
|
|
826
|
-
accountId: accessToken.accountId,
|
|
827
|
-
expiration: new Date(accessToken.expiresAt)
|
|
828
|
-
}
|
|
829
|
-
];
|
|
830
|
-
}
|
|
831
|
-
});
|
|
832
|
-
})();
|
|
833
|
-
}
|
|
834
|
-
},
|
|
835
|
-
{
|
|
836
|
-
key: "logger",
|
|
837
|
-
get: function get() {
|
|
838
|
-
var _this_init;
|
|
839
|
-
return (_this_init = this.init) === null || _this_init === void 0 ? void 0 : _this_init.logger;
|
|
840
|
-
}
|
|
841
|
-
},
|
|
842
|
-
{
|
|
843
|
-
key: "loginSession",
|
|
844
|
-
get: function get() {
|
|
845
|
-
return this.profileData.login_session;
|
|
846
|
-
}
|
|
847
|
-
},
|
|
848
|
-
{
|
|
849
|
-
key: "refresh",
|
|
850
|
-
value: function refresh(token) {
|
|
851
|
-
var _this = this;
|
|
852
|
-
return _async_to_generator$8(function() {
|
|
853
|
-
var _this_callerClientConfig, _this_callerClientConfig1, _this_callerClientConfig_region, _this_callerClientConfig2, _this_init, _ref, SigninClient, CreateOAuth2TokenCommand, _this_callerClientConfig3, _ref1, logger, userAgentAppId, isH2, requestHandler, _this_profileData_region, _ref2, region, _tmp, client, commandInput, _response_tokenOutput, response, _response_tokenOutput_accessToken, _ref3, accessKeyId, secretAccessKey, sessionToken, _response_tokenOutput1, _ref4, refreshToken, expiresIn, expiresInMs, expiration, updatedToken, newAccessToken, error, errorType, message;
|
|
854
|
-
return _ts_generator$8(this, function(_state) {
|
|
855
|
-
switch(_state.label){
|
|
856
|
-
case 0:
|
|
857
|
-
return [
|
|
858
|
-
4,
|
|
859
|
-
import('./index.esm11.js')
|
|
860
|
-
];
|
|
861
|
-
case 1:
|
|
862
|
-
_ref = _state.sent(), SigninClient = _ref.SigninClient, CreateOAuth2TokenCommand = _ref.CreateOAuth2TokenCommand;
|
|
863
|
-
_ref1 = (_this_callerClientConfig3 = _this.callerClientConfig) !== null && _this_callerClientConfig3 !== void 0 ? _this_callerClientConfig3 : {}, logger = _ref1.logger, userAgentAppId = _ref1.userAgentAppId;
|
|
864
|
-
isH2 = function(requestHandler) {
|
|
865
|
-
var _requestHandler_metadata;
|
|
866
|
-
return (requestHandler === null || requestHandler === void 0 ? void 0 : (_requestHandler_metadata = requestHandler.metadata) === null || _requestHandler_metadata === void 0 ? void 0 : _requestHandler_metadata.handlerProtocol) === "h2";
|
|
867
|
-
};
|
|
868
|
-
requestHandler = isH2((_this_callerClientConfig = _this.callerClientConfig) === null || _this_callerClientConfig === void 0 ? void 0 : _this_callerClientConfig.requestHandler) ? undefined : (_this_callerClientConfig1 = _this.callerClientConfig) === null || _this_callerClientConfig1 === void 0 ? void 0 : _this_callerClientConfig1.requestHandler;
|
|
869
|
-
if (!((_this_profileData_region = _this.profileData.region) !== null && _this_profileData_region !== void 0)) return [
|
|
870
|
-
3,
|
|
871
|
-
2
|
|
872
|
-
];
|
|
873
|
-
_tmp = _this_profileData_region;
|
|
874
|
-
return [
|
|
875
|
-
3,
|
|
876
|
-
4
|
|
877
|
-
];
|
|
878
|
-
case 2:
|
|
879
|
-
return [
|
|
880
|
-
4,
|
|
881
|
-
(_this_callerClientConfig2 = _this.callerClientConfig) === null || _this_callerClientConfig2 === void 0 ? void 0 : (_this_callerClientConfig_region = _this_callerClientConfig2.region) === null || _this_callerClientConfig_region === void 0 ? void 0 : _this_callerClientConfig_region.call(_this_callerClientConfig2)
|
|
882
|
-
];
|
|
883
|
-
case 3:
|
|
884
|
-
_tmp = _state.sent();
|
|
885
|
-
_state.label = 4;
|
|
886
|
-
case 4:
|
|
887
|
-
region = (_ref2 = _tmp) !== null && _ref2 !== void 0 ? _ref2 : process.env.AWS_REGION;
|
|
888
|
-
client = new SigninClient(_object_spread$3({
|
|
889
|
-
credentials: {
|
|
890
|
-
accessKeyId: "",
|
|
891
|
-
secretAccessKey: ""
|
|
892
|
-
},
|
|
893
|
-
region: region,
|
|
894
|
-
requestHandler: requestHandler,
|
|
895
|
-
logger: logger,
|
|
896
|
-
userAgentAppId: userAgentAppId
|
|
897
|
-
}, (_this_init = _this.init) === null || _this_init === void 0 ? void 0 : _this_init.clientConfig));
|
|
898
|
-
_this.createDPoPInterceptor(client.middlewareStack);
|
|
899
|
-
commandInput = {
|
|
900
|
-
tokenInput: {
|
|
901
|
-
clientId: token.clientId,
|
|
902
|
-
refreshToken: token.refreshToken,
|
|
903
|
-
grantType: "refresh_token"
|
|
904
|
-
}
|
|
905
|
-
};
|
|
906
|
-
_state.label = 5;
|
|
907
|
-
case 5:
|
|
908
|
-
_state.trys.push([
|
|
909
|
-
5,
|
|
910
|
-
8,
|
|
911
|
-
,
|
|
912
|
-
9
|
|
913
|
-
]);
|
|
914
|
-
return [
|
|
915
|
-
4,
|
|
916
|
-
client.send(new CreateOAuth2TokenCommand(commandInput))
|
|
917
|
-
];
|
|
918
|
-
case 6:
|
|
919
|
-
response = _state.sent();
|
|
920
|
-
_ref3 = (_response_tokenOutput_accessToken = (_response_tokenOutput = response.tokenOutput) === null || _response_tokenOutput === void 0 ? void 0 : _response_tokenOutput.accessToken) !== null && _response_tokenOutput_accessToken !== void 0 ? _response_tokenOutput_accessToken : {}, accessKeyId = _ref3.accessKeyId, secretAccessKey = _ref3.secretAccessKey, sessionToken = _ref3.sessionToken;
|
|
921
|
-
_ref4 = (_response_tokenOutput1 = response.tokenOutput) !== null && _response_tokenOutput1 !== void 0 ? _response_tokenOutput1 : {}, refreshToken = _ref4.refreshToken, expiresIn = _ref4.expiresIn;
|
|
922
|
-
if (!accessKeyId || !secretAccessKey || !sessionToken || !refreshToken) {
|
|
923
|
-
throw new CredentialsProviderError("Token refresh response missing required fields", {
|
|
924
|
-
logger: _this.logger,
|
|
925
|
-
tryNextLink: false
|
|
926
|
-
});
|
|
927
|
-
}
|
|
928
|
-
expiresInMs = (expiresIn !== null && expiresIn !== void 0 ? expiresIn : 900) * 1000;
|
|
929
|
-
expiration = new Date(Date.now() + expiresInMs);
|
|
930
|
-
updatedToken = _object_spread_props$2(_object_spread$3({}, token), {
|
|
931
|
-
accessToken: _object_spread_props$2(_object_spread$3({}, token.accessToken), {
|
|
932
|
-
accessKeyId: accessKeyId,
|
|
933
|
-
secretAccessKey: secretAccessKey,
|
|
934
|
-
sessionToken: sessionToken,
|
|
935
|
-
expiresAt: expiration.toISOString()
|
|
936
|
-
}),
|
|
937
|
-
refreshToken: refreshToken
|
|
938
|
-
});
|
|
939
|
-
return [
|
|
940
|
-
4,
|
|
941
|
-
_this.saveToken(updatedToken)
|
|
942
|
-
];
|
|
943
|
-
case 7:
|
|
944
|
-
_state.sent();
|
|
945
|
-
newAccessToken = updatedToken.accessToken;
|
|
946
|
-
return [
|
|
947
|
-
2,
|
|
948
|
-
{
|
|
949
|
-
accessKeyId: newAccessToken.accessKeyId,
|
|
950
|
-
secretAccessKey: newAccessToken.secretAccessKey,
|
|
951
|
-
sessionToken: newAccessToken.sessionToken,
|
|
952
|
-
accountId: newAccessToken.accountId,
|
|
953
|
-
expiration: expiration
|
|
954
|
-
}
|
|
955
|
-
];
|
|
956
|
-
case 8:
|
|
957
|
-
error = _state.sent();
|
|
958
|
-
if (error.name === "AccessDeniedException") {
|
|
959
|
-
errorType = error.error;
|
|
960
|
-
switch(errorType){
|
|
961
|
-
case "TOKEN_EXPIRED":
|
|
962
|
-
message = "Your session has expired. Please reauthenticate.";
|
|
963
|
-
break;
|
|
964
|
-
case "USER_CREDENTIALS_CHANGED":
|
|
965
|
-
message = "Unable to refresh credentials because of a change in your password. Please reauthenticate with your new password.";
|
|
966
|
-
break;
|
|
967
|
-
case "INSUFFICIENT_PERMISSIONS":
|
|
968
|
-
message = "Unable to refresh credentials due to insufficient permissions. You may be missing permission for the 'CreateOAuth2Token' action.";
|
|
969
|
-
break;
|
|
970
|
-
default:
|
|
971
|
-
message = "Failed to refresh token: ".concat(String(error), ". Please re-authenticate using `aws login`");
|
|
972
|
-
}
|
|
973
|
-
throw new CredentialsProviderError(message, {
|
|
974
|
-
logger: _this.logger,
|
|
975
|
-
tryNextLink: false
|
|
976
|
-
});
|
|
977
|
-
}
|
|
978
|
-
throw new CredentialsProviderError("Failed to refresh token: ".concat(String(error), ". Please re-authenticate using aws login"), {
|
|
979
|
-
logger: _this.logger
|
|
980
|
-
});
|
|
981
|
-
case 9:
|
|
982
|
-
return [
|
|
983
|
-
2
|
|
984
|
-
];
|
|
985
|
-
}
|
|
986
|
-
});
|
|
987
|
-
})();
|
|
988
|
-
}
|
|
989
|
-
},
|
|
990
|
-
{
|
|
991
|
-
key: "loadToken",
|
|
992
|
-
value: function loadToken() {
|
|
993
|
-
var _this = this;
|
|
994
|
-
return _async_to_generator$8(function() {
|
|
995
|
-
var tokenFilePath, _token_accessToken, tokenData, _this_init, token, missingFields, error;
|
|
996
|
-
return _ts_generator$8(this, function(_state) {
|
|
997
|
-
switch(_state.label){
|
|
998
|
-
case 0:
|
|
999
|
-
tokenFilePath = _this.getTokenFilePath();
|
|
1000
|
-
_state.label = 1;
|
|
1001
|
-
case 1:
|
|
1002
|
-
_state.trys.push([
|
|
1003
|
-
1,
|
|
1004
|
-
7,
|
|
1005
|
-
,
|
|
1006
|
-
8
|
|
1007
|
-
]);
|
|
1008
|
-
_state.label = 2;
|
|
1009
|
-
case 2:
|
|
1010
|
-
_state.trys.push([
|
|
1011
|
-
2,
|
|
1012
|
-
4,
|
|
1013
|
-
,
|
|
1014
|
-
6
|
|
1015
|
-
]);
|
|
1016
|
-
return [
|
|
1017
|
-
4,
|
|
1018
|
-
readFile(tokenFilePath, {
|
|
1019
|
-
ignoreCache: (_this_init = _this.init) === null || _this_init === void 0 ? void 0 : _this_init.ignoreCache
|
|
1020
|
-
})
|
|
1021
|
-
];
|
|
1022
|
-
case 3:
|
|
1023
|
-
tokenData = _state.sent();
|
|
1024
|
-
return [
|
|
1025
|
-
3,
|
|
1026
|
-
6
|
|
1027
|
-
];
|
|
1028
|
-
case 4:
|
|
1029
|
-
_state.sent();
|
|
1030
|
-
return [
|
|
1031
|
-
4,
|
|
1032
|
-
promises.readFile(tokenFilePath, "utf8")
|
|
1033
|
-
];
|
|
1034
|
-
case 5:
|
|
1035
|
-
tokenData = _state.sent();
|
|
1036
|
-
return [
|
|
1037
|
-
3,
|
|
1038
|
-
6
|
|
1039
|
-
];
|
|
1040
|
-
case 6:
|
|
1041
|
-
token = JSON.parse(tokenData);
|
|
1042
|
-
missingFields = [
|
|
1043
|
-
"accessToken",
|
|
1044
|
-
"clientId",
|
|
1045
|
-
"refreshToken",
|
|
1046
|
-
"dpopKey"
|
|
1047
|
-
].filter(function(k) {
|
|
1048
|
-
return !token[k];
|
|
1049
|
-
});
|
|
1050
|
-
if (!((_token_accessToken = token.accessToken) === null || _token_accessToken === void 0 ? void 0 : _token_accessToken.accountId)) {
|
|
1051
|
-
missingFields.push("accountId");
|
|
1052
|
-
}
|
|
1053
|
-
if (missingFields.length > 0) {
|
|
1054
|
-
throw new CredentialsProviderError("Token validation failed, missing fields: ".concat(missingFields.join(", ")), {
|
|
1055
|
-
logger: _this.logger,
|
|
1056
|
-
tryNextLink: false
|
|
1057
|
-
});
|
|
1058
|
-
}
|
|
1059
|
-
return [
|
|
1060
|
-
2,
|
|
1061
|
-
token
|
|
1062
|
-
];
|
|
1063
|
-
case 7:
|
|
1064
|
-
error = _state.sent();
|
|
1065
|
-
throw new CredentialsProviderError("Failed to load token from ".concat(tokenFilePath, ": ").concat(String(error)), {
|
|
1066
|
-
logger: _this.logger,
|
|
1067
|
-
tryNextLink: false
|
|
1068
|
-
});
|
|
1069
|
-
case 8:
|
|
1070
|
-
return [
|
|
1071
|
-
2
|
|
1072
|
-
];
|
|
408
|
+
var ENV_TOKEN_FILE = "AWS_WEB_IDENTITY_TOKEN_FILE";
|
|
409
|
+
var ENV_ROLE_ARN = "AWS_ROLE_ARN";
|
|
410
|
+
var ENV_ROLE_SESSION_NAME = "AWS_ROLE_SESSION_NAME";
|
|
411
|
+
var fromTokenFile = function() {
|
|
412
|
+
var init = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
413
|
+
return function() {
|
|
414
|
+
var _ref = _async_to_generator(function(awsIdentityProperties) {
|
|
415
|
+
var _init_logger, _externalDataInterceptor_getTokenRecord, _init_webIdentityTokenFile, webIdentityTokenFile, _init_roleArn, roleArn, _init_roleSessionName, roleSessionName, _externalDataInterceptor_getTokenRecord_webIdentityTokenFile, credentials;
|
|
416
|
+
return _ts_generator(this, function(_state) {
|
|
417
|
+
switch(_state.label){
|
|
418
|
+
case 0:
|
|
419
|
+
(_init_logger = init.logger) === null || _init_logger === void 0 ? void 0 : _init_logger.debug("@aws-sdk/credential-provider-web-identity - fromTokenFile");
|
|
420
|
+
webIdentityTokenFile = (_init_webIdentityTokenFile = init === null || init === void 0 ? void 0 : init.webIdentityTokenFile) !== null && _init_webIdentityTokenFile !== void 0 ? _init_webIdentityTokenFile : process.env[ENV_TOKEN_FILE];
|
|
421
|
+
roleArn = (_init_roleArn = init === null || init === void 0 ? void 0 : init.roleArn) !== null && _init_roleArn !== void 0 ? _init_roleArn : process.env[ENV_ROLE_ARN];
|
|
422
|
+
roleSessionName = (_init_roleSessionName = init === null || init === void 0 ? void 0 : init.roleSessionName) !== null && _init_roleSessionName !== void 0 ? _init_roleSessionName : process.env[ENV_ROLE_SESSION_NAME];
|
|
423
|
+
if (!webIdentityTokenFile || !roleArn) {
|
|
424
|
+
throw new CredentialsProviderError("Web identity configuration not specified", {
|
|
425
|
+
logger: init.logger
|
|
426
|
+
});
|
|
1073
427
|
}
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
directory = dirname(tokenFilePath);
|
|
1089
|
-
_state.label = 1;
|
|
1090
|
-
case 1:
|
|
1091
|
-
_state.trys.push([
|
|
1092
|
-
1,
|
|
1093
|
-
3,
|
|
1094
|
-
,
|
|
1095
|
-
4
|
|
1096
|
-
]);
|
|
1097
|
-
return [
|
|
1098
|
-
4,
|
|
1099
|
-
promises.mkdir(directory, {
|
|
1100
|
-
recursive: true
|
|
1101
|
-
})
|
|
1102
|
-
];
|
|
1103
|
-
case 2:
|
|
1104
|
-
_state.sent();
|
|
1105
|
-
return [
|
|
1106
|
-
3,
|
|
1107
|
-
4
|
|
1108
|
-
];
|
|
1109
|
-
case 3:
|
|
1110
|
-
_state.sent();
|
|
1111
|
-
return [
|
|
1112
|
-
3,
|
|
1113
|
-
4
|
|
1114
|
-
];
|
|
1115
|
-
case 4:
|
|
1116
|
-
return [
|
|
1117
|
-
4,
|
|
1118
|
-
promises.writeFile(tokenFilePath, JSON.stringify(token, null, 2), "utf8")
|
|
1119
|
-
];
|
|
1120
|
-
case 5:
|
|
1121
|
-
_state.sent();
|
|
1122
|
-
return [
|
|
1123
|
-
2
|
|
1124
|
-
];
|
|
428
|
+
return [
|
|
429
|
+
4,
|
|
430
|
+
fromWebToken(_object_spread_props(_object_spread({}, init), {
|
|
431
|
+
webIdentityToken: (_externalDataInterceptor_getTokenRecord_webIdentityTokenFile = externalDataInterceptor === null || externalDataInterceptor === void 0 ? void 0 : (_externalDataInterceptor_getTokenRecord = externalDataInterceptor.getTokenRecord) === null || _externalDataInterceptor_getTokenRecord === void 0 ? void 0 : _externalDataInterceptor_getTokenRecord.call(externalDataInterceptor)[webIdentityTokenFile]) !== null && _externalDataInterceptor_getTokenRecord_webIdentityTokenFile !== void 0 ? _externalDataInterceptor_getTokenRecord_webIdentityTokenFile : readFileSync(webIdentityTokenFile, {
|
|
432
|
+
encoding: "ascii"
|
|
433
|
+
}),
|
|
434
|
+
roleArn: roleArn,
|
|
435
|
+
roleSessionName: roleSessionName
|
|
436
|
+
}))(awsIdentityProperties)
|
|
437
|
+
];
|
|
438
|
+
case 1:
|
|
439
|
+
credentials = _state.sent();
|
|
440
|
+
if (webIdentityTokenFile === process.env[ENV_TOKEN_FILE]) {
|
|
441
|
+
setCredentialFeature(credentials, "CREDENTIALS_ENV_VARS_STS_WEB_ID_TOKEN", "h");
|
|
1125
442
|
}
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
{
|
|
1131
|
-
key: "getTokenFilePath",
|
|
1132
|
-
value: function getTokenFilePath() {
|
|
1133
|
-
var _process_env_AWS_LOGIN_CACHE_DIRECTORY;
|
|
1134
|
-
var directory = (_process_env_AWS_LOGIN_CACHE_DIRECTORY = process.env.AWS_LOGIN_CACHE_DIRECTORY) !== null && _process_env_AWS_LOGIN_CACHE_DIRECTORY !== void 0 ? _process_env_AWS_LOGIN_CACHE_DIRECTORY : join(homedir(), ".aws", "login", "cache");
|
|
1135
|
-
var loginSessionBytes = Buffer.from(this.loginSession, "utf8");
|
|
1136
|
-
var loginSessionSha256 = createHash("sha256").update(loginSessionBytes).digest("hex");
|
|
1137
|
-
return join(directory, "".concat(loginSessionSha256, ".json"));
|
|
1138
|
-
}
|
|
1139
|
-
},
|
|
1140
|
-
{
|
|
1141
|
-
key: "derToRawSignature",
|
|
1142
|
-
value: function derToRawSignature(derSignature) {
|
|
1143
|
-
var offset = 2;
|
|
1144
|
-
if (derSignature[offset] !== 0x02) {
|
|
1145
|
-
throw new Error("Invalid DER signature");
|
|
1146
|
-
}
|
|
1147
|
-
offset++;
|
|
1148
|
-
var rLength = derSignature[offset++];
|
|
1149
|
-
var r = derSignature.subarray(offset, offset + rLength);
|
|
1150
|
-
offset += rLength;
|
|
1151
|
-
if (derSignature[offset] !== 0x02) {
|
|
1152
|
-
throw new Error("Invalid DER signature");
|
|
443
|
+
return [
|
|
444
|
+
2,
|
|
445
|
+
credentials
|
|
446
|
+
];
|
|
1153
447
|
}
|
|
1154
|
-
|
|
1155
|
-
var sLength = derSignature[offset++];
|
|
1156
|
-
var s = derSignature.subarray(offset, offset + sLength);
|
|
1157
|
-
r = r[0] === 0x00 ? r.subarray(1) : r;
|
|
1158
|
-
s = s[0] === 0x00 ? s.subarray(1) : s;
|
|
1159
|
-
var rPadded = Buffer.concat([
|
|
1160
|
-
Buffer.alloc(32 - r.length),
|
|
1161
|
-
r
|
|
1162
|
-
]);
|
|
1163
|
-
var sPadded = Buffer.concat([
|
|
1164
|
-
Buffer.alloc(32 - s.length),
|
|
1165
|
-
s
|
|
1166
|
-
]);
|
|
1167
|
-
return Buffer.concat([
|
|
1168
|
-
rPadded,
|
|
1169
|
-
sPadded
|
|
1170
|
-
]);
|
|
1171
|
-
}
|
|
1172
|
-
},
|
|
1173
|
-
{
|
|
1174
|
-
key: "createDPoPInterceptor",
|
|
1175
|
-
value: function createDPoPInterceptor(middlewareStack) {
|
|
1176
|
-
var _this = this;
|
|
1177
|
-
middlewareStack.add(function(next) {
|
|
1178
|
-
return function() {
|
|
1179
|
-
var _ref = _async_to_generator$8(function(args) {
|
|
1180
|
-
var request, actualEndpoint, dpop;
|
|
1181
|
-
return _ts_generator$8(this, function(_state) {
|
|
1182
|
-
switch(_state.label){
|
|
1183
|
-
case 0:
|
|
1184
|
-
if (!HttpRequest.isInstance(args.request)) return [
|
|
1185
|
-
3,
|
|
1186
|
-
2
|
|
1187
|
-
];
|
|
1188
|
-
request = args.request;
|
|
1189
|
-
actualEndpoint = "".concat(request.protocol, "//").concat(request.hostname).concat(request.port ? ":".concat(request.port) : "").concat(request.path);
|
|
1190
|
-
return [
|
|
1191
|
-
4,
|
|
1192
|
-
_this.generateDpop(request.method, actualEndpoint)
|
|
1193
|
-
];
|
|
1194
|
-
case 1:
|
|
1195
|
-
dpop = _state.sent();
|
|
1196
|
-
request.headers = _object_spread_props$2(_object_spread$3({}, request.headers), {
|
|
1197
|
-
DPoP: dpop
|
|
1198
|
-
});
|
|
1199
|
-
_state.label = 2;
|
|
1200
|
-
case 2:
|
|
1201
|
-
return [
|
|
1202
|
-
2,
|
|
1203
|
-
next(args)
|
|
1204
|
-
];
|
|
1205
|
-
}
|
|
1206
|
-
});
|
|
1207
|
-
});
|
|
1208
|
-
return function(args) {
|
|
1209
|
-
return _ref.apply(this, arguments);
|
|
1210
|
-
};
|
|
1211
|
-
}();
|
|
1212
|
-
}, {
|
|
1213
|
-
step: "finalizeRequest",
|
|
1214
|
-
name: "dpopInterceptor",
|
|
1215
|
-
override: true
|
|
1216
|
-
});
|
|
1217
|
-
}
|
|
1218
|
-
},
|
|
1219
|
-
{
|
|
1220
|
-
key: "generateDpop",
|
|
1221
|
-
value: function generateDpop() {
|
|
1222
|
-
var method = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "POST", endpoint = arguments.length > 1 ? arguments[1] : void 0;
|
|
1223
|
-
var _this = this;
|
|
1224
|
-
return _async_to_generator$8(function() {
|
|
1225
|
-
var token, privateKey, publicKey, publicDer, pointStart, i, x, y, header, payload, headerB64, payloadB64, message, asn1Signature, rawSignature, signatureB64;
|
|
1226
|
-
return _ts_generator$8(this, function(_state) {
|
|
1227
|
-
switch(_state.label){
|
|
1228
|
-
case 0:
|
|
1229
|
-
return [
|
|
1230
|
-
4,
|
|
1231
|
-
_this.loadToken()
|
|
1232
|
-
];
|
|
1233
|
-
case 1:
|
|
1234
|
-
token = _state.sent();
|
|
1235
|
-
try {
|
|
1236
|
-
privateKey = createPrivateKey({
|
|
1237
|
-
key: token.dpopKey,
|
|
1238
|
-
format: "pem",
|
|
1239
|
-
type: "sec1"
|
|
1240
|
-
});
|
|
1241
|
-
publicKey = createPublicKey(privateKey);
|
|
1242
|
-
publicDer = publicKey.export({
|
|
1243
|
-
format: "der",
|
|
1244
|
-
type: "spki"
|
|
1245
|
-
});
|
|
1246
|
-
pointStart = -1;
|
|
1247
|
-
for(i = 0; i < publicDer.length; i++){
|
|
1248
|
-
if (publicDer[i] === 0x04) {
|
|
1249
|
-
pointStart = i;
|
|
1250
|
-
break;
|
|
1251
|
-
}
|
|
1252
|
-
}
|
|
1253
|
-
x = publicDer.slice(pointStart + 1, pointStart + 33);
|
|
1254
|
-
y = publicDer.slice(pointStart + 33, pointStart + 65);
|
|
1255
|
-
header = {
|
|
1256
|
-
alg: "ES256",
|
|
1257
|
-
typ: "dpop+jwt",
|
|
1258
|
-
jwk: {
|
|
1259
|
-
kty: "EC",
|
|
1260
|
-
crv: "P-256",
|
|
1261
|
-
x: x.toString("base64url"),
|
|
1262
|
-
y: y.toString("base64url")
|
|
1263
|
-
}
|
|
1264
|
-
};
|
|
1265
|
-
payload = {
|
|
1266
|
-
jti: crypto.randomUUID(),
|
|
1267
|
-
htm: method,
|
|
1268
|
-
htu: endpoint,
|
|
1269
|
-
iat: Math.floor(Date.now() / 1000)
|
|
1270
|
-
};
|
|
1271
|
-
headerB64 = Buffer.from(JSON.stringify(header)).toString("base64url");
|
|
1272
|
-
payloadB64 = Buffer.from(JSON.stringify(payload)).toString("base64url");
|
|
1273
|
-
message = "".concat(headerB64, ".").concat(payloadB64);
|
|
1274
|
-
asn1Signature = sign("sha256", Buffer.from(message), privateKey);
|
|
1275
|
-
rawSignature = _this.derToRawSignature(asn1Signature);
|
|
1276
|
-
signatureB64 = rawSignature.toString("base64url");
|
|
1277
|
-
return [
|
|
1278
|
-
2,
|
|
1279
|
-
"".concat(message, ".").concat(signatureB64)
|
|
1280
|
-
];
|
|
1281
|
-
} catch (error) {
|
|
1282
|
-
throw new CredentialsProviderError("Failed to generate Dpop proof: ".concat(_instanceof(error, Error) ? error.message : String(error)), {
|
|
1283
|
-
logger: _this.logger,
|
|
1284
|
-
tryNextLink: false
|
|
1285
|
-
});
|
|
1286
|
-
}
|
|
1287
|
-
return [
|
|
1288
|
-
2
|
|
1289
|
-
];
|
|
1290
|
-
}
|
|
1291
|
-
});
|
|
1292
|
-
})();
|
|
1293
|
-
}
|
|
1294
|
-
}
|
|
1295
|
-
]);
|
|
1296
|
-
return LoginCredentialsFetcher;
|
|
1297
|
-
}();
|
|
1298
|
-
_define_property$3(LoginCredentialsFetcher, "REFRESH_THRESHOLD", 5 * 60 * 1000);
|
|
1299
|
-
|
|
1300
|
-
function asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1301
|
-
try {
|
|
1302
|
-
var info = gen[key](arg);
|
|
1303
|
-
var value = info.value;
|
|
1304
|
-
} catch (error) {
|
|
1305
|
-
reject(error);
|
|
1306
|
-
return;
|
|
1307
|
-
}
|
|
1308
|
-
if (info.done) {
|
|
1309
|
-
resolve(value);
|
|
1310
|
-
} else {
|
|
1311
|
-
Promise.resolve(value).then(_next, _throw);
|
|
1312
|
-
}
|
|
1313
|
-
}
|
|
1314
|
-
function _async_to_generator$7(fn) {
|
|
1315
|
-
return function() {
|
|
1316
|
-
var self = this, args = arguments;
|
|
1317
|
-
return new Promise(function(resolve, reject) {
|
|
1318
|
-
var gen = fn.apply(self, args);
|
|
1319
|
-
function _next(value) {
|
|
1320
|
-
asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, "next", value);
|
|
1321
|
-
}
|
|
1322
|
-
function _throw(err) {
|
|
1323
|
-
asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, "throw", err);
|
|
1324
|
-
}
|
|
1325
|
-
_next(undefined);
|
|
1326
|
-
});
|
|
1327
|
-
};
|
|
1328
|
-
}
|
|
1329
|
-
function _ts_generator$7(thisArg, body) {
|
|
1330
|
-
var f, y, t, g, _ = {
|
|
1331
|
-
label: 0,
|
|
1332
|
-
sent: function() {
|
|
1333
|
-
if (t[0] & 1) throw t[1];
|
|
1334
|
-
return t[1];
|
|
1335
|
-
},
|
|
1336
|
-
trys: [],
|
|
1337
|
-
ops: []
|
|
1338
|
-
};
|
|
1339
|
-
return g = {
|
|
1340
|
-
next: verb(0),
|
|
1341
|
-
"throw": verb(1),
|
|
1342
|
-
"return": verb(2)
|
|
1343
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
1344
|
-
return this;
|
|
1345
|
-
}), g;
|
|
1346
|
-
function verb(n) {
|
|
1347
|
-
return function(v) {
|
|
1348
|
-
return step([
|
|
1349
|
-
n,
|
|
1350
|
-
v
|
|
1351
|
-
]);
|
|
1352
|
-
};
|
|
1353
|
-
}
|
|
1354
|
-
function step(op) {
|
|
1355
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
1356
|
-
while(_)try {
|
|
1357
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
1358
|
-
if (y = 0, t) op = [
|
|
1359
|
-
op[0] & 2,
|
|
1360
|
-
t.value
|
|
1361
|
-
];
|
|
1362
|
-
switch(op[0]){
|
|
1363
|
-
case 0:
|
|
1364
|
-
case 1:
|
|
1365
|
-
t = op;
|
|
1366
|
-
break;
|
|
1367
|
-
case 4:
|
|
1368
|
-
_.label++;
|
|
1369
|
-
return {
|
|
1370
|
-
value: op[1],
|
|
1371
|
-
done: false
|
|
1372
|
-
};
|
|
1373
|
-
case 5:
|
|
1374
|
-
_.label++;
|
|
1375
|
-
y = op[1];
|
|
1376
|
-
op = [
|
|
1377
|
-
0
|
|
1378
|
-
];
|
|
1379
|
-
continue;
|
|
1380
|
-
case 7:
|
|
1381
|
-
op = _.ops.pop();
|
|
1382
|
-
_.trys.pop();
|
|
1383
|
-
continue;
|
|
1384
|
-
default:
|
|
1385
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
1386
|
-
_ = 0;
|
|
1387
|
-
continue;
|
|
1388
|
-
}
|
|
1389
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
1390
|
-
_.label = op[1];
|
|
1391
|
-
break;
|
|
1392
|
-
}
|
|
1393
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
1394
|
-
_.label = t[1];
|
|
1395
|
-
t = op;
|
|
1396
|
-
break;
|
|
1397
|
-
}
|
|
1398
|
-
if (t && _.label < t[2]) {
|
|
1399
|
-
_.label = t[2];
|
|
1400
|
-
_.ops.push(op);
|
|
1401
|
-
break;
|
|
1402
|
-
}
|
|
1403
|
-
if (t[2]) _.ops.pop();
|
|
1404
|
-
_.trys.pop();
|
|
1405
|
-
continue;
|
|
1406
|
-
}
|
|
1407
|
-
op = body.call(thisArg, _);
|
|
1408
|
-
} catch (e) {
|
|
1409
|
-
op = [
|
|
1410
|
-
6,
|
|
1411
|
-
e
|
|
1412
|
-
];
|
|
1413
|
-
y = 0;
|
|
1414
|
-
} finally{
|
|
1415
|
-
f = t = 0;
|
|
1416
|
-
}
|
|
1417
|
-
if (op[0] & 5) throw op[1];
|
|
1418
|
-
return {
|
|
1419
|
-
value: op[0] ? op[1] : void 0,
|
|
1420
|
-
done: true
|
|
1421
|
-
};
|
|
1422
|
-
}
|
|
1423
|
-
}
|
|
1424
|
-
var fromLoginCredentials = function(init) {
|
|
1425
|
-
return /*#__PURE__*/ _async_to_generator$7(function() {
|
|
1426
|
-
var callerClientConfig, _init_logger_debug, _init_logger, profiles, _init_profile, profileName, profile, fetcher, credentials;
|
|
1427
|
-
var _arguments = arguments;
|
|
1428
|
-
return _ts_generator$7(this, function(_state) {
|
|
1429
|
-
switch(_state.label){
|
|
1430
|
-
case 0:
|
|
1431
|
-
callerClientConfig = (_arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {}).callerClientConfig;
|
|
1432
|
-
init === null || init === void 0 ? void 0 : (_init_logger = init.logger) === null || _init_logger === void 0 ? void 0 : (_init_logger_debug = _init_logger.debug) === null || _init_logger_debug === void 0 ? void 0 : _init_logger_debug.call(_init_logger, "@aws-sdk/credential-providers - fromLoginCredentials");
|
|
1433
|
-
return [
|
|
1434
|
-
4,
|
|
1435
|
-
parseKnownFiles(init || {})
|
|
1436
|
-
];
|
|
1437
|
-
case 1:
|
|
1438
|
-
profiles = _state.sent();
|
|
1439
|
-
profileName = getProfileName({
|
|
1440
|
-
profile: (_init_profile = init === null || init === void 0 ? void 0 : init.profile) !== null && _init_profile !== void 0 ? _init_profile : callerClientConfig === null || callerClientConfig === void 0 ? void 0 : callerClientConfig.profile
|
|
1441
|
-
});
|
|
1442
|
-
profile = profiles[profileName];
|
|
1443
|
-
if (!(profile === null || profile === void 0 ? void 0 : profile.login_session)) {
|
|
1444
|
-
throw new CredentialsProviderError("Profile ".concat(profileName, " does not contain login_session."), {
|
|
1445
|
-
tryNextLink: true,
|
|
1446
|
-
logger: init === null || init === void 0 ? void 0 : init.logger
|
|
1447
|
-
});
|
|
1448
|
-
}
|
|
1449
|
-
fetcher = new LoginCredentialsFetcher(profile, init, callerClientConfig);
|
|
1450
|
-
return [
|
|
1451
|
-
4,
|
|
1452
|
-
fetcher.loadCredentials()
|
|
1453
|
-
];
|
|
1454
|
-
case 2:
|
|
1455
|
-
credentials = _state.sent();
|
|
1456
|
-
return [
|
|
1457
|
-
2,
|
|
1458
|
-
setCredentialFeature(credentials, "CREDENTIALS_LOGIN", "AD")
|
|
1459
|
-
];
|
|
1460
|
-
}
|
|
1461
|
-
});
|
|
1462
|
-
});
|
|
1463
|
-
};
|
|
1464
|
-
|
|
1465
|
-
function asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1466
|
-
try {
|
|
1467
|
-
var info = gen[key](arg);
|
|
1468
|
-
var value = info.value;
|
|
1469
|
-
} catch (error) {
|
|
1470
|
-
reject(error);
|
|
1471
|
-
return;
|
|
1472
|
-
}
|
|
1473
|
-
if (info.done) {
|
|
1474
|
-
resolve(value);
|
|
1475
|
-
} else {
|
|
1476
|
-
Promise.resolve(value).then(_next, _throw);
|
|
1477
|
-
}
|
|
1478
|
-
}
|
|
1479
|
-
function _async_to_generator$6(fn) {
|
|
1480
|
-
return function() {
|
|
1481
|
-
var self = this, args = arguments;
|
|
1482
|
-
return new Promise(function(resolve, reject) {
|
|
1483
|
-
var gen = fn.apply(self, args);
|
|
1484
|
-
function _next(value) {
|
|
1485
|
-
asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, "next", value);
|
|
1486
|
-
}
|
|
1487
|
-
function _throw(err) {
|
|
1488
|
-
asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, "throw", err);
|
|
1489
|
-
}
|
|
1490
|
-
_next(undefined);
|
|
1491
|
-
});
|
|
1492
|
-
};
|
|
1493
|
-
}
|
|
1494
|
-
function _define_property$2(obj, key, value) {
|
|
1495
|
-
if (key in obj) {
|
|
1496
|
-
Object.defineProperty(obj, key, {
|
|
1497
|
-
value: value,
|
|
1498
|
-
enumerable: true,
|
|
1499
|
-
configurable: true,
|
|
1500
|
-
writable: true
|
|
1501
|
-
});
|
|
1502
|
-
} else {
|
|
1503
|
-
obj[key] = value;
|
|
1504
|
-
}
|
|
1505
|
-
return obj;
|
|
1506
|
-
}
|
|
1507
|
-
function _object_spread$2(target) {
|
|
1508
|
-
for(var i = 1; i < arguments.length; i++){
|
|
1509
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
1510
|
-
var ownKeys = Object.keys(source);
|
|
1511
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
1512
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
1513
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
1514
|
-
}));
|
|
1515
|
-
}
|
|
1516
|
-
ownKeys.forEach(function(key) {
|
|
1517
|
-
_define_property$2(target, key, source[key]);
|
|
1518
|
-
});
|
|
1519
|
-
}
|
|
1520
|
-
return target;
|
|
1521
|
-
}
|
|
1522
|
-
function ownKeys$1(object, enumerableOnly) {
|
|
1523
|
-
var keys = Object.keys(object);
|
|
1524
|
-
if (Object.getOwnPropertySymbols) {
|
|
1525
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
1526
|
-
keys.push.apply(keys, symbols);
|
|
1527
|
-
}
|
|
1528
|
-
return keys;
|
|
1529
|
-
}
|
|
1530
|
-
function _object_spread_props$1(target, source) {
|
|
1531
|
-
source = source != null ? source : {};
|
|
1532
|
-
if (Object.getOwnPropertyDescriptors) {
|
|
1533
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
1534
|
-
} else {
|
|
1535
|
-
ownKeys$1(Object(source)).forEach(function(key) {
|
|
1536
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
1537
|
-
});
|
|
1538
|
-
}
|
|
1539
|
-
return target;
|
|
1540
|
-
}
|
|
1541
|
-
function _ts_generator$6(thisArg, body) {
|
|
1542
|
-
var f, y, t, g, _ = {
|
|
1543
|
-
label: 0,
|
|
1544
|
-
sent: function() {
|
|
1545
|
-
if (t[0] & 1) throw t[1];
|
|
1546
|
-
return t[1];
|
|
1547
|
-
},
|
|
1548
|
-
trys: [],
|
|
1549
|
-
ops: []
|
|
1550
|
-
};
|
|
1551
|
-
return g = {
|
|
1552
|
-
next: verb(0),
|
|
1553
|
-
"throw": verb(1),
|
|
1554
|
-
"return": verb(2)
|
|
1555
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
1556
|
-
return this;
|
|
1557
|
-
}), g;
|
|
1558
|
-
function verb(n) {
|
|
1559
|
-
return function(v) {
|
|
1560
|
-
return step([
|
|
1561
|
-
n,
|
|
1562
|
-
v
|
|
1563
|
-
]);
|
|
1564
|
-
};
|
|
1565
|
-
}
|
|
1566
|
-
function step(op) {
|
|
1567
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
1568
|
-
while(_)try {
|
|
1569
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
1570
|
-
if (y = 0, t) op = [
|
|
1571
|
-
op[0] & 2,
|
|
1572
|
-
t.value
|
|
1573
|
-
];
|
|
1574
|
-
switch(op[0]){
|
|
1575
|
-
case 0:
|
|
1576
|
-
case 1:
|
|
1577
|
-
t = op;
|
|
1578
|
-
break;
|
|
1579
|
-
case 4:
|
|
1580
|
-
_.label++;
|
|
1581
|
-
return {
|
|
1582
|
-
value: op[1],
|
|
1583
|
-
done: false
|
|
1584
|
-
};
|
|
1585
|
-
case 5:
|
|
1586
|
-
_.label++;
|
|
1587
|
-
y = op[1];
|
|
1588
|
-
op = [
|
|
1589
|
-
0
|
|
1590
|
-
];
|
|
1591
|
-
continue;
|
|
1592
|
-
case 7:
|
|
1593
|
-
op = _.ops.pop();
|
|
1594
|
-
_.trys.pop();
|
|
1595
|
-
continue;
|
|
1596
|
-
default:
|
|
1597
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
1598
|
-
_ = 0;
|
|
1599
|
-
continue;
|
|
1600
|
-
}
|
|
1601
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
1602
|
-
_.label = op[1];
|
|
1603
|
-
break;
|
|
1604
|
-
}
|
|
1605
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
1606
|
-
_.label = t[1];
|
|
1607
|
-
t = op;
|
|
1608
|
-
break;
|
|
1609
|
-
}
|
|
1610
|
-
if (t && _.label < t[2]) {
|
|
1611
|
-
_.label = t[2];
|
|
1612
|
-
_.ops.push(op);
|
|
1613
|
-
break;
|
|
1614
|
-
}
|
|
1615
|
-
if (t[2]) _.ops.pop();
|
|
1616
|
-
_.trys.pop();
|
|
1617
|
-
continue;
|
|
1618
|
-
}
|
|
1619
|
-
op = body.call(thisArg, _);
|
|
1620
|
-
} catch (e) {
|
|
1621
|
-
op = [
|
|
1622
|
-
6,
|
|
1623
|
-
e
|
|
1624
|
-
];
|
|
1625
|
-
y = 0;
|
|
1626
|
-
} finally{
|
|
1627
|
-
f = t = 0;
|
|
1628
|
-
}
|
|
1629
|
-
if (op[0] & 5) throw op[1];
|
|
1630
|
-
return {
|
|
1631
|
-
value: op[0] ? op[1] : void 0,
|
|
1632
|
-
done: true
|
|
1633
|
-
};
|
|
1634
|
-
}
|
|
1635
|
-
}
|
|
1636
|
-
var isLoginProfile = function(data) {
|
|
1637
|
-
return Boolean(data && data.login_session);
|
|
1638
|
-
};
|
|
1639
|
-
var resolveLoginCredentials = function() {
|
|
1640
|
-
var _ref = _async_to_generator$6(function(profileName, options, callerClientConfig) {
|
|
1641
|
-
var credentials;
|
|
1642
|
-
return _ts_generator$6(this, function(_state) {
|
|
1643
|
-
switch(_state.label){
|
|
1644
|
-
case 0:
|
|
1645
|
-
return [
|
|
1646
|
-
4,
|
|
1647
|
-
fromLoginCredentials(_object_spread_props$1(_object_spread$2({}, options), {
|
|
1648
|
-
profile: profileName
|
|
1649
|
-
}))({
|
|
1650
|
-
callerClientConfig: callerClientConfig
|
|
1651
|
-
})
|
|
1652
|
-
];
|
|
1653
|
-
case 1:
|
|
1654
|
-
credentials = _state.sent();
|
|
1655
|
-
return [
|
|
1656
|
-
2,
|
|
1657
|
-
setCredentialFeature(credentials, "CREDENTIALS_PROFILE_LOGIN", "AC")
|
|
1658
|
-
];
|
|
1659
|
-
}
|
|
1660
|
-
});
|
|
1661
|
-
});
|
|
1662
|
-
return function resolveLoginCredentials(profileName, options, callerClientConfig) {
|
|
1663
|
-
return _ref.apply(this, arguments);
|
|
1664
|
-
};
|
|
1665
|
-
}();
|
|
1666
|
-
|
|
1667
|
-
function asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1668
|
-
try {
|
|
1669
|
-
var info = gen[key](arg);
|
|
1670
|
-
var value = info.value;
|
|
1671
|
-
} catch (error) {
|
|
1672
|
-
reject(error);
|
|
1673
|
-
return;
|
|
1674
|
-
}
|
|
1675
|
-
if (info.done) {
|
|
1676
|
-
resolve(value);
|
|
1677
|
-
} else {
|
|
1678
|
-
Promise.resolve(value).then(_next, _throw);
|
|
1679
|
-
}
|
|
1680
|
-
}
|
|
1681
|
-
function _async_to_generator$5(fn) {
|
|
1682
|
-
return function() {
|
|
1683
|
-
var self = this, args = arguments;
|
|
1684
|
-
return new Promise(function(resolve, reject) {
|
|
1685
|
-
var gen = fn.apply(self, args);
|
|
1686
|
-
function _next(value) {
|
|
1687
|
-
asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, "next", value);
|
|
1688
|
-
}
|
|
1689
|
-
function _throw(err) {
|
|
1690
|
-
asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, "throw", err);
|
|
1691
|
-
}
|
|
1692
|
-
_next(undefined);
|
|
1693
|
-
});
|
|
1694
|
-
};
|
|
1695
|
-
}
|
|
1696
|
-
function _define_property$1(obj, key, value) {
|
|
1697
|
-
if (key in obj) {
|
|
1698
|
-
Object.defineProperty(obj, key, {
|
|
1699
|
-
value: value,
|
|
1700
|
-
enumerable: true,
|
|
1701
|
-
configurable: true,
|
|
1702
|
-
writable: true
|
|
1703
|
-
});
|
|
1704
|
-
} else {
|
|
1705
|
-
obj[key] = value;
|
|
1706
|
-
}
|
|
1707
|
-
return obj;
|
|
1708
|
-
}
|
|
1709
|
-
function _object_spread$1(target) {
|
|
1710
|
-
for(var i = 1; i < arguments.length; i++){
|
|
1711
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
1712
|
-
var ownKeys = Object.keys(source);
|
|
1713
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
1714
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
1715
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
1716
|
-
}));
|
|
1717
|
-
}
|
|
1718
|
-
ownKeys.forEach(function(key) {
|
|
1719
|
-
_define_property$1(target, key, source[key]);
|
|
1720
|
-
});
|
|
1721
|
-
}
|
|
1722
|
-
return target;
|
|
1723
|
-
}
|
|
1724
|
-
function ownKeys(object, enumerableOnly) {
|
|
1725
|
-
var keys = Object.keys(object);
|
|
1726
|
-
if (Object.getOwnPropertySymbols) {
|
|
1727
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
1728
|
-
keys.push.apply(keys, symbols);
|
|
1729
|
-
}
|
|
1730
|
-
return keys;
|
|
1731
|
-
}
|
|
1732
|
-
function _object_spread_props(target, source) {
|
|
1733
|
-
source = source != null ? source : {};
|
|
1734
|
-
if (Object.getOwnPropertyDescriptors) {
|
|
1735
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
1736
|
-
} else {
|
|
1737
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
1738
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
1739
|
-
});
|
|
1740
|
-
}
|
|
1741
|
-
return target;
|
|
1742
|
-
}
|
|
1743
|
-
function _type_of$2(obj) {
|
|
1744
|
-
"@swc/helpers - typeof";
|
|
1745
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
1746
|
-
}
|
|
1747
|
-
function _ts_generator$5(thisArg, body) {
|
|
1748
|
-
var f, y, t, g, _ = {
|
|
1749
|
-
label: 0,
|
|
1750
|
-
sent: function() {
|
|
1751
|
-
if (t[0] & 1) throw t[1];
|
|
1752
|
-
return t[1];
|
|
1753
|
-
},
|
|
1754
|
-
trys: [],
|
|
1755
|
-
ops: []
|
|
1756
|
-
};
|
|
1757
|
-
return g = {
|
|
1758
|
-
next: verb(0),
|
|
1759
|
-
"throw": verb(1),
|
|
1760
|
-
"return": verb(2)
|
|
1761
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
1762
|
-
return this;
|
|
1763
|
-
}), g;
|
|
1764
|
-
function verb(n) {
|
|
1765
|
-
return function(v) {
|
|
1766
|
-
return step([
|
|
1767
|
-
n,
|
|
1768
|
-
v
|
|
1769
|
-
]);
|
|
1770
|
-
};
|
|
1771
|
-
}
|
|
1772
|
-
function step(op) {
|
|
1773
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
1774
|
-
while(_)try {
|
|
1775
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
1776
|
-
if (y = 0, t) op = [
|
|
1777
|
-
op[0] & 2,
|
|
1778
|
-
t.value
|
|
1779
|
-
];
|
|
1780
|
-
switch(op[0]){
|
|
1781
|
-
case 0:
|
|
1782
|
-
case 1:
|
|
1783
|
-
t = op;
|
|
1784
|
-
break;
|
|
1785
|
-
case 4:
|
|
1786
|
-
_.label++;
|
|
1787
|
-
return {
|
|
1788
|
-
value: op[1],
|
|
1789
|
-
done: false
|
|
1790
|
-
};
|
|
1791
|
-
case 5:
|
|
1792
|
-
_.label++;
|
|
1793
|
-
y = op[1];
|
|
1794
|
-
op = [
|
|
1795
|
-
0
|
|
1796
|
-
];
|
|
1797
|
-
continue;
|
|
1798
|
-
case 7:
|
|
1799
|
-
op = _.ops.pop();
|
|
1800
|
-
_.trys.pop();
|
|
1801
|
-
continue;
|
|
1802
|
-
default:
|
|
1803
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
1804
|
-
_ = 0;
|
|
1805
|
-
continue;
|
|
1806
|
-
}
|
|
1807
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
1808
|
-
_.label = op[1];
|
|
1809
|
-
break;
|
|
1810
|
-
}
|
|
1811
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
1812
|
-
_.label = t[1];
|
|
1813
|
-
t = op;
|
|
1814
|
-
break;
|
|
1815
|
-
}
|
|
1816
|
-
if (t && _.label < t[2]) {
|
|
1817
|
-
_.label = t[2];
|
|
1818
|
-
_.ops.push(op);
|
|
1819
|
-
break;
|
|
1820
|
-
}
|
|
1821
|
-
if (t[2]) _.ops.pop();
|
|
1822
|
-
_.trys.pop();
|
|
1823
|
-
continue;
|
|
1824
|
-
}
|
|
1825
|
-
op = body.call(thisArg, _);
|
|
1826
|
-
} catch (e) {
|
|
1827
|
-
op = [
|
|
1828
|
-
6,
|
|
1829
|
-
e
|
|
1830
|
-
];
|
|
1831
|
-
y = 0;
|
|
1832
|
-
} finally{
|
|
1833
|
-
f = t = 0;
|
|
1834
|
-
}
|
|
1835
|
-
if (op[0] & 5) throw op[1];
|
|
1836
|
-
return {
|
|
1837
|
-
value: op[0] ? op[1] : void 0,
|
|
1838
|
-
done: true
|
|
1839
|
-
};
|
|
1840
|
-
}
|
|
1841
|
-
}
|
|
1842
|
-
var isProcessProfile = function(arg) {
|
|
1843
|
-
return Boolean(arg) && (typeof arg === "undefined" ? "undefined" : _type_of$2(arg)) === "object" && typeof arg.credential_process === "string";
|
|
1844
|
-
};
|
|
1845
|
-
var resolveProcessCredentials = function() {
|
|
1846
|
-
var _ref = _async_to_generator$5(function(options, profile) {
|
|
1847
|
-
return _ts_generator$5(this, function(_state) {
|
|
1848
|
-
return [
|
|
1849
|
-
2,
|
|
1850
|
-
import('./index.esm7.js').then(function(param) {
|
|
1851
|
-
var fromProcess = param.fromProcess;
|
|
1852
|
-
return fromProcess(_object_spread_props(_object_spread$1({}, options), {
|
|
1853
|
-
profile: profile
|
|
1854
|
-
}))().then(function(creds) {
|
|
1855
|
-
return setCredentialFeature(creds, "CREDENTIALS_PROFILE_PROCESS", "v");
|
|
1856
|
-
});
|
|
1857
|
-
})
|
|
1858
|
-
];
|
|
1859
|
-
});
|
|
1860
|
-
});
|
|
1861
|
-
return function resolveProcessCredentials(options, profile) {
|
|
1862
|
-
return _ref.apply(this, arguments);
|
|
1863
|
-
};
|
|
1864
|
-
}();
|
|
1865
|
-
|
|
1866
|
-
function asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1867
|
-
try {
|
|
1868
|
-
var info = gen[key](arg);
|
|
1869
|
-
var value = info.value;
|
|
1870
|
-
} catch (error) {
|
|
1871
|
-
reject(error);
|
|
1872
|
-
return;
|
|
1873
|
-
}
|
|
1874
|
-
if (info.done) {
|
|
1875
|
-
resolve(value);
|
|
1876
|
-
} else {
|
|
1877
|
-
Promise.resolve(value).then(_next, _throw);
|
|
1878
|
-
}
|
|
1879
|
-
}
|
|
1880
|
-
function _async_to_generator$4(fn) {
|
|
1881
|
-
return function() {
|
|
1882
|
-
var self = this, args = arguments;
|
|
1883
|
-
return new Promise(function(resolve, reject) {
|
|
1884
|
-
var gen = fn.apply(self, args);
|
|
1885
|
-
function _next(value) {
|
|
1886
|
-
asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "next", value);
|
|
1887
|
-
}
|
|
1888
|
-
function _throw(err) {
|
|
1889
|
-
asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "throw", err);
|
|
1890
|
-
}
|
|
1891
|
-
_next(undefined);
|
|
1892
|
-
});
|
|
1893
|
-
};
|
|
1894
|
-
}
|
|
1895
|
-
function _ts_generator$4(thisArg, body) {
|
|
1896
|
-
var f, y, t, g, _ = {
|
|
1897
|
-
label: 0,
|
|
1898
|
-
sent: function() {
|
|
1899
|
-
if (t[0] & 1) throw t[1];
|
|
1900
|
-
return t[1];
|
|
1901
|
-
},
|
|
1902
|
-
trys: [],
|
|
1903
|
-
ops: []
|
|
1904
|
-
};
|
|
1905
|
-
return g = {
|
|
1906
|
-
next: verb(0),
|
|
1907
|
-
"throw": verb(1),
|
|
1908
|
-
"return": verb(2)
|
|
1909
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
1910
|
-
return this;
|
|
1911
|
-
}), g;
|
|
1912
|
-
function verb(n) {
|
|
1913
|
-
return function(v) {
|
|
1914
|
-
return step([
|
|
1915
|
-
n,
|
|
1916
|
-
v
|
|
1917
|
-
]);
|
|
1918
|
-
};
|
|
1919
|
-
}
|
|
1920
|
-
function step(op) {
|
|
1921
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
1922
|
-
while(_)try {
|
|
1923
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
1924
|
-
if (y = 0, t) op = [
|
|
1925
|
-
op[0] & 2,
|
|
1926
|
-
t.value
|
|
1927
|
-
];
|
|
1928
|
-
switch(op[0]){
|
|
1929
|
-
case 0:
|
|
1930
|
-
case 1:
|
|
1931
|
-
t = op;
|
|
1932
|
-
break;
|
|
1933
|
-
case 4:
|
|
1934
|
-
_.label++;
|
|
1935
|
-
return {
|
|
1936
|
-
value: op[1],
|
|
1937
|
-
done: false
|
|
1938
|
-
};
|
|
1939
|
-
case 5:
|
|
1940
|
-
_.label++;
|
|
1941
|
-
y = op[1];
|
|
1942
|
-
op = [
|
|
1943
|
-
0
|
|
1944
|
-
];
|
|
1945
|
-
continue;
|
|
1946
|
-
case 7:
|
|
1947
|
-
op = _.ops.pop();
|
|
1948
|
-
_.trys.pop();
|
|
1949
|
-
continue;
|
|
1950
|
-
default:
|
|
1951
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
1952
|
-
_ = 0;
|
|
1953
|
-
continue;
|
|
1954
|
-
}
|
|
1955
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
1956
|
-
_.label = op[1];
|
|
1957
|
-
break;
|
|
1958
|
-
}
|
|
1959
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
1960
|
-
_.label = t[1];
|
|
1961
|
-
t = op;
|
|
1962
|
-
break;
|
|
1963
|
-
}
|
|
1964
|
-
if (t && _.label < t[2]) {
|
|
1965
|
-
_.label = t[2];
|
|
1966
|
-
_.ops.push(op);
|
|
1967
|
-
break;
|
|
1968
|
-
}
|
|
1969
|
-
if (t[2]) _.ops.pop();
|
|
1970
|
-
_.trys.pop();
|
|
1971
|
-
continue;
|
|
1972
|
-
}
|
|
1973
|
-
op = body.call(thisArg, _);
|
|
1974
|
-
} catch (e) {
|
|
1975
|
-
op = [
|
|
1976
|
-
6,
|
|
1977
|
-
e
|
|
1978
|
-
];
|
|
1979
|
-
y = 0;
|
|
1980
|
-
} finally{
|
|
1981
|
-
f = t = 0;
|
|
1982
|
-
}
|
|
1983
|
-
if (op[0] & 5) throw op[1];
|
|
1984
|
-
return {
|
|
1985
|
-
value: op[0] ? op[1] : void 0,
|
|
1986
|
-
done: true
|
|
1987
|
-
};
|
|
1988
|
-
}
|
|
1989
|
-
}
|
|
1990
|
-
var resolveSsoCredentials = function() {
|
|
1991
|
-
var _ref = _async_to_generator$4(function(profile, profileData) {
|
|
1992
|
-
var options, callerClientConfig, fromSSO;
|
|
1993
|
-
var _arguments = arguments;
|
|
1994
|
-
return _ts_generator$4(this, function(_state) {
|
|
1995
|
-
switch(_state.label){
|
|
1996
|
-
case 0:
|
|
1997
|
-
options = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {}, callerClientConfig = _arguments.length > 3 ? _arguments[3] : void 0;
|
|
1998
|
-
return [
|
|
1999
|
-
4,
|
|
2000
|
-
import('./index.esm12.js')
|
|
2001
|
-
];
|
|
2002
|
-
case 1:
|
|
2003
|
-
fromSSO = _state.sent().fromSSO;
|
|
2004
|
-
return [
|
|
2005
|
-
2,
|
|
2006
|
-
fromSSO({
|
|
2007
|
-
profile: profile,
|
|
2008
|
-
logger: options.logger,
|
|
2009
|
-
parentClientConfig: options.parentClientConfig,
|
|
2010
|
-
clientConfig: options.clientConfig
|
|
2011
|
-
})({
|
|
2012
|
-
callerClientConfig: callerClientConfig
|
|
2013
|
-
}).then(function(creds) {
|
|
2014
|
-
if (profileData.sso_session) {
|
|
2015
|
-
return setCredentialFeature(creds, "CREDENTIALS_PROFILE_SSO", "r");
|
|
2016
|
-
} else {
|
|
2017
|
-
return setCredentialFeature(creds, "CREDENTIALS_PROFILE_SSO_LEGACY", "t");
|
|
2018
|
-
}
|
|
2019
|
-
})
|
|
2020
|
-
];
|
|
2021
|
-
}
|
|
2022
|
-
});
|
|
2023
|
-
});
|
|
2024
|
-
return function resolveSsoCredentials(profile, profileData) {
|
|
2025
|
-
return _ref.apply(this, arguments);
|
|
2026
|
-
};
|
|
2027
|
-
}();
|
|
2028
|
-
var isSsoProfile = function(arg) {
|
|
2029
|
-
return arg && (typeof arg.sso_start_url === "string" || typeof arg.sso_account_id === "string" || typeof arg.sso_session === "string" || typeof arg.sso_region === "string" || typeof arg.sso_role_name === "string");
|
|
2030
|
-
};
|
|
2031
|
-
|
|
2032
|
-
function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2033
|
-
try {
|
|
2034
|
-
var info = gen[key](arg);
|
|
2035
|
-
var value = info.value;
|
|
2036
|
-
} catch (error) {
|
|
2037
|
-
reject(error);
|
|
2038
|
-
return;
|
|
2039
|
-
}
|
|
2040
|
-
if (info.done) {
|
|
2041
|
-
resolve(value);
|
|
2042
|
-
} else {
|
|
2043
|
-
Promise.resolve(value).then(_next, _throw);
|
|
2044
|
-
}
|
|
2045
|
-
}
|
|
2046
|
-
function _async_to_generator$3(fn) {
|
|
2047
|
-
return function() {
|
|
2048
|
-
var self = this, args = arguments;
|
|
2049
|
-
return new Promise(function(resolve, reject) {
|
|
2050
|
-
var gen = fn.apply(self, args);
|
|
2051
|
-
function _next(value) {
|
|
2052
|
-
asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "next", value);
|
|
2053
|
-
}
|
|
2054
|
-
function _throw(err) {
|
|
2055
|
-
asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "throw", err);
|
|
2056
|
-
}
|
|
2057
|
-
_next(undefined);
|
|
2058
|
-
});
|
|
2059
|
-
};
|
|
2060
|
-
}
|
|
2061
|
-
function _define_property(obj, key, value) {
|
|
2062
|
-
if (key in obj) {
|
|
2063
|
-
Object.defineProperty(obj, key, {
|
|
2064
|
-
value: value,
|
|
2065
|
-
enumerable: true,
|
|
2066
|
-
configurable: true,
|
|
2067
|
-
writable: true
|
|
2068
|
-
});
|
|
2069
|
-
} else {
|
|
2070
|
-
obj[key] = value;
|
|
2071
|
-
}
|
|
2072
|
-
return obj;
|
|
2073
|
-
}
|
|
2074
|
-
function _object_spread(target) {
|
|
2075
|
-
for(var i = 1; i < arguments.length; i++){
|
|
2076
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
2077
|
-
var ownKeys = Object.keys(source);
|
|
2078
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
2079
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
2080
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
2081
|
-
}));
|
|
2082
|
-
}
|
|
2083
|
-
ownKeys.forEach(function(key) {
|
|
2084
|
-
_define_property(target, key, source[key]);
|
|
2085
|
-
});
|
|
2086
|
-
}
|
|
2087
|
-
return target;
|
|
2088
|
-
}
|
|
2089
|
-
function _type_of$1(obj) {
|
|
2090
|
-
"@swc/helpers - typeof";
|
|
2091
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
2092
|
-
}
|
|
2093
|
-
function _ts_generator$3(thisArg, body) {
|
|
2094
|
-
var f, y, t, g, _ = {
|
|
2095
|
-
label: 0,
|
|
2096
|
-
sent: function() {
|
|
2097
|
-
if (t[0] & 1) throw t[1];
|
|
2098
|
-
return t[1];
|
|
2099
|
-
},
|
|
2100
|
-
trys: [],
|
|
2101
|
-
ops: []
|
|
2102
|
-
};
|
|
2103
|
-
return g = {
|
|
2104
|
-
next: verb(0),
|
|
2105
|
-
"throw": verb(1),
|
|
2106
|
-
"return": verb(2)
|
|
2107
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
2108
|
-
return this;
|
|
2109
|
-
}), g;
|
|
2110
|
-
function verb(n) {
|
|
2111
|
-
return function(v) {
|
|
2112
|
-
return step([
|
|
2113
|
-
n,
|
|
2114
|
-
v
|
|
2115
|
-
]);
|
|
2116
|
-
};
|
|
2117
|
-
}
|
|
2118
|
-
function step(op) {
|
|
2119
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
2120
|
-
while(_)try {
|
|
2121
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
2122
|
-
if (y = 0, t) op = [
|
|
2123
|
-
op[0] & 2,
|
|
2124
|
-
t.value
|
|
2125
|
-
];
|
|
2126
|
-
switch(op[0]){
|
|
2127
|
-
case 0:
|
|
2128
|
-
case 1:
|
|
2129
|
-
t = op;
|
|
2130
|
-
break;
|
|
2131
|
-
case 4:
|
|
2132
|
-
_.label++;
|
|
2133
|
-
return {
|
|
2134
|
-
value: op[1],
|
|
2135
|
-
done: false
|
|
2136
|
-
};
|
|
2137
|
-
case 5:
|
|
2138
|
-
_.label++;
|
|
2139
|
-
y = op[1];
|
|
2140
|
-
op = [
|
|
2141
|
-
0
|
|
2142
|
-
];
|
|
2143
|
-
continue;
|
|
2144
|
-
case 7:
|
|
2145
|
-
op = _.ops.pop();
|
|
2146
|
-
_.trys.pop();
|
|
2147
|
-
continue;
|
|
2148
|
-
default:
|
|
2149
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
2150
|
-
_ = 0;
|
|
2151
|
-
continue;
|
|
2152
|
-
}
|
|
2153
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
2154
|
-
_.label = op[1];
|
|
2155
|
-
break;
|
|
2156
|
-
}
|
|
2157
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
2158
|
-
_.label = t[1];
|
|
2159
|
-
t = op;
|
|
2160
|
-
break;
|
|
2161
|
-
}
|
|
2162
|
-
if (t && _.label < t[2]) {
|
|
2163
|
-
_.label = t[2];
|
|
2164
|
-
_.ops.push(op);
|
|
2165
|
-
break;
|
|
2166
|
-
}
|
|
2167
|
-
if (t[2]) _.ops.pop();
|
|
2168
|
-
_.trys.pop();
|
|
2169
|
-
continue;
|
|
2170
|
-
}
|
|
2171
|
-
op = body.call(thisArg, _);
|
|
2172
|
-
} catch (e) {
|
|
2173
|
-
op = [
|
|
2174
|
-
6,
|
|
2175
|
-
e
|
|
2176
|
-
];
|
|
2177
|
-
y = 0;
|
|
2178
|
-
} finally{
|
|
2179
|
-
f = t = 0;
|
|
2180
|
-
}
|
|
2181
|
-
if (op[0] & 5) throw op[1];
|
|
2182
|
-
return {
|
|
2183
|
-
value: op[0] ? op[1] : void 0,
|
|
2184
|
-
done: true
|
|
2185
|
-
};
|
|
2186
|
-
}
|
|
2187
|
-
}
|
|
2188
|
-
var isStaticCredsProfile = function(arg) {
|
|
2189
|
-
return Boolean(arg) && (typeof arg === "undefined" ? "undefined" : _type_of$1(arg)) === "object" && typeof arg.aws_access_key_id === "string" && typeof arg.aws_secret_access_key === "string" && [
|
|
2190
|
-
"undefined",
|
|
2191
|
-
"string"
|
|
2192
|
-
].indexOf(_type_of$1(arg.aws_session_token)) > -1 && [
|
|
2193
|
-
"undefined",
|
|
2194
|
-
"string"
|
|
2195
|
-
].indexOf(_type_of$1(arg.aws_account_id)) > -1;
|
|
2196
|
-
};
|
|
2197
|
-
var resolveStaticCredentials = function() {
|
|
2198
|
-
var _ref = _async_to_generator$3(function(profile, options) {
|
|
2199
|
-
var _options_logger, credentials;
|
|
2200
|
-
return _ts_generator$3(this, function(_state) {
|
|
2201
|
-
options === null || options === void 0 ? void 0 : (_options_logger = options.logger) === null || _options_logger === void 0 ? void 0 : _options_logger.debug("@aws-sdk/credential-provider-ini - resolveStaticCredentials");
|
|
2202
|
-
credentials = _object_spread({
|
|
2203
|
-
accessKeyId: profile.aws_access_key_id,
|
|
2204
|
-
secretAccessKey: profile.aws_secret_access_key,
|
|
2205
|
-
sessionToken: profile.aws_session_token
|
|
2206
|
-
}, profile.aws_credential_scope && {
|
|
2207
|
-
credentialScope: profile.aws_credential_scope
|
|
2208
|
-
}, profile.aws_account_id && {
|
|
2209
|
-
accountId: profile.aws_account_id
|
|
2210
|
-
});
|
|
2211
|
-
return [
|
|
2212
|
-
2,
|
|
2213
|
-
setCredentialFeature(credentials, "CREDENTIALS_PROFILE", "n")
|
|
2214
|
-
];
|
|
2215
|
-
});
|
|
2216
|
-
});
|
|
2217
|
-
return function resolveStaticCredentials(profile, options) {
|
|
2218
|
-
return _ref.apply(this, arguments);
|
|
2219
|
-
};
|
|
2220
|
-
}();
|
|
2221
|
-
|
|
2222
|
-
function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2223
|
-
try {
|
|
2224
|
-
var info = gen[key](arg);
|
|
2225
|
-
var value = info.value;
|
|
2226
|
-
} catch (error) {
|
|
2227
|
-
reject(error);
|
|
2228
|
-
return;
|
|
2229
|
-
}
|
|
2230
|
-
if (info.done) {
|
|
2231
|
-
resolve(value);
|
|
2232
|
-
} else {
|
|
2233
|
-
Promise.resolve(value).then(_next, _throw);
|
|
2234
|
-
}
|
|
2235
|
-
}
|
|
2236
|
-
function _async_to_generator$2(fn) {
|
|
2237
|
-
return function() {
|
|
2238
|
-
var self = this, args = arguments;
|
|
2239
|
-
return new Promise(function(resolve, reject) {
|
|
2240
|
-
var gen = fn.apply(self, args);
|
|
2241
|
-
function _next(value) {
|
|
2242
|
-
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
|
|
2243
|
-
}
|
|
2244
|
-
function _throw(err) {
|
|
2245
|
-
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
|
|
2246
|
-
}
|
|
2247
|
-
_next(undefined);
|
|
2248
|
-
});
|
|
2249
|
-
};
|
|
2250
|
-
}
|
|
2251
|
-
function _type_of(obj) {
|
|
2252
|
-
"@swc/helpers - typeof";
|
|
2253
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
2254
|
-
}
|
|
2255
|
-
function _ts_generator$2(thisArg, body) {
|
|
2256
|
-
var f, y, t, g, _ = {
|
|
2257
|
-
label: 0,
|
|
2258
|
-
sent: function() {
|
|
2259
|
-
if (t[0] & 1) throw t[1];
|
|
2260
|
-
return t[1];
|
|
2261
|
-
},
|
|
2262
|
-
trys: [],
|
|
2263
|
-
ops: []
|
|
2264
|
-
};
|
|
2265
|
-
return g = {
|
|
2266
|
-
next: verb(0),
|
|
2267
|
-
"throw": verb(1),
|
|
2268
|
-
"return": verb(2)
|
|
2269
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
2270
|
-
return this;
|
|
2271
|
-
}), g;
|
|
2272
|
-
function verb(n) {
|
|
2273
|
-
return function(v) {
|
|
2274
|
-
return step([
|
|
2275
|
-
n,
|
|
2276
|
-
v
|
|
2277
|
-
]);
|
|
2278
|
-
};
|
|
2279
|
-
}
|
|
2280
|
-
function step(op) {
|
|
2281
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
2282
|
-
while(_)try {
|
|
2283
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
2284
|
-
if (y = 0, t) op = [
|
|
2285
|
-
op[0] & 2,
|
|
2286
|
-
t.value
|
|
2287
|
-
];
|
|
2288
|
-
switch(op[0]){
|
|
2289
|
-
case 0:
|
|
2290
|
-
case 1:
|
|
2291
|
-
t = op;
|
|
2292
|
-
break;
|
|
2293
|
-
case 4:
|
|
2294
|
-
_.label++;
|
|
2295
|
-
return {
|
|
2296
|
-
value: op[1],
|
|
2297
|
-
done: false
|
|
2298
|
-
};
|
|
2299
|
-
case 5:
|
|
2300
|
-
_.label++;
|
|
2301
|
-
y = op[1];
|
|
2302
|
-
op = [
|
|
2303
|
-
0
|
|
2304
|
-
];
|
|
2305
|
-
continue;
|
|
2306
|
-
case 7:
|
|
2307
|
-
op = _.ops.pop();
|
|
2308
|
-
_.trys.pop();
|
|
2309
|
-
continue;
|
|
2310
|
-
default:
|
|
2311
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
2312
|
-
_ = 0;
|
|
2313
|
-
continue;
|
|
2314
|
-
}
|
|
2315
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
2316
|
-
_.label = op[1];
|
|
2317
|
-
break;
|
|
2318
|
-
}
|
|
2319
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
2320
|
-
_.label = t[1];
|
|
2321
|
-
t = op;
|
|
2322
|
-
break;
|
|
2323
|
-
}
|
|
2324
|
-
if (t && _.label < t[2]) {
|
|
2325
|
-
_.label = t[2];
|
|
2326
|
-
_.ops.push(op);
|
|
2327
|
-
break;
|
|
2328
|
-
}
|
|
2329
|
-
if (t[2]) _.ops.pop();
|
|
2330
|
-
_.trys.pop();
|
|
2331
|
-
continue;
|
|
2332
|
-
}
|
|
2333
|
-
op = body.call(thisArg, _);
|
|
2334
|
-
} catch (e) {
|
|
2335
|
-
op = [
|
|
2336
|
-
6,
|
|
2337
|
-
e
|
|
2338
|
-
];
|
|
2339
|
-
y = 0;
|
|
2340
|
-
} finally{
|
|
2341
|
-
f = t = 0;
|
|
2342
|
-
}
|
|
2343
|
-
if (op[0] & 5) throw op[1];
|
|
2344
|
-
return {
|
|
2345
|
-
value: op[0] ? op[1] : void 0,
|
|
2346
|
-
done: true
|
|
2347
|
-
};
|
|
2348
|
-
}
|
|
2349
|
-
}
|
|
2350
|
-
var isWebIdentityProfile = function(arg) {
|
|
2351
|
-
return Boolean(arg) && (typeof arg === "undefined" ? "undefined" : _type_of(arg)) === "object" && typeof arg.web_identity_token_file === "string" && typeof arg.role_arn === "string" && [
|
|
2352
|
-
"undefined",
|
|
2353
|
-
"string"
|
|
2354
|
-
].indexOf(_type_of(arg.role_session_name)) > -1;
|
|
2355
|
-
};
|
|
2356
|
-
var resolveWebIdentityCredentials = function() {
|
|
2357
|
-
var _ref = _async_to_generator$2(function(profile, options, callerClientConfig) {
|
|
2358
|
-
return _ts_generator$2(this, function(_state) {
|
|
2359
|
-
return [
|
|
2360
|
-
2,
|
|
2361
|
-
import('./index.esm4.js').then(function(param) {
|
|
2362
|
-
var fromTokenFile = param.fromTokenFile;
|
|
2363
|
-
return fromTokenFile({
|
|
2364
|
-
webIdentityTokenFile: profile.web_identity_token_file,
|
|
2365
|
-
roleArn: profile.role_arn,
|
|
2366
|
-
roleSessionName: profile.role_session_name,
|
|
2367
|
-
roleAssumerWithWebIdentity: options.roleAssumerWithWebIdentity,
|
|
2368
|
-
logger: options.logger,
|
|
2369
|
-
parentClientConfig: options.parentClientConfig
|
|
2370
|
-
})({
|
|
2371
|
-
callerClientConfig: callerClientConfig
|
|
2372
|
-
}).then(function(creds) {
|
|
2373
|
-
return setCredentialFeature(creds, "CREDENTIALS_PROFILE_STS_WEB_ID_TOKEN", "q");
|
|
2374
|
-
});
|
|
2375
|
-
})
|
|
2376
|
-
];
|
|
2377
|
-
});
|
|
2378
|
-
});
|
|
2379
|
-
return function resolveWebIdentityCredentials(profile, options, callerClientConfig) {
|
|
2380
|
-
return _ref.apply(this, arguments);
|
|
2381
|
-
};
|
|
2382
|
-
}();
|
|
2383
|
-
|
|
2384
|
-
function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2385
|
-
try {
|
|
2386
|
-
var info = gen[key](arg);
|
|
2387
|
-
var value = info.value;
|
|
2388
|
-
} catch (error) {
|
|
2389
|
-
reject(error);
|
|
2390
|
-
return;
|
|
2391
|
-
}
|
|
2392
|
-
if (info.done) {
|
|
2393
|
-
resolve(value);
|
|
2394
|
-
} else {
|
|
2395
|
-
Promise.resolve(value).then(_next, _throw);
|
|
2396
|
-
}
|
|
2397
|
-
}
|
|
2398
|
-
function _async_to_generator$1(fn) {
|
|
2399
|
-
return function() {
|
|
2400
|
-
var self = this, args = arguments;
|
|
2401
|
-
return new Promise(function(resolve, reject) {
|
|
2402
|
-
var gen = fn.apply(self, args);
|
|
2403
|
-
function _next(value) {
|
|
2404
|
-
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
|
|
2405
|
-
}
|
|
2406
|
-
function _throw(err) {
|
|
2407
|
-
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
|
|
2408
|
-
}
|
|
2409
|
-
_next(undefined);
|
|
2410
|
-
});
|
|
2411
|
-
};
|
|
2412
|
-
}
|
|
2413
|
-
function _ts_generator$1(thisArg, body) {
|
|
2414
|
-
var f, y, t, g, _ = {
|
|
2415
|
-
label: 0,
|
|
2416
|
-
sent: function() {
|
|
2417
|
-
if (t[0] & 1) throw t[1];
|
|
2418
|
-
return t[1];
|
|
2419
|
-
},
|
|
2420
|
-
trys: [],
|
|
2421
|
-
ops: []
|
|
2422
|
-
};
|
|
2423
|
-
return g = {
|
|
2424
|
-
next: verb(0),
|
|
2425
|
-
"throw": verb(1),
|
|
2426
|
-
"return": verb(2)
|
|
2427
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
2428
|
-
return this;
|
|
2429
|
-
}), g;
|
|
2430
|
-
function verb(n) {
|
|
2431
|
-
return function(v) {
|
|
2432
|
-
return step([
|
|
2433
|
-
n,
|
|
2434
|
-
v
|
|
2435
|
-
]);
|
|
2436
|
-
};
|
|
2437
|
-
}
|
|
2438
|
-
function step(op) {
|
|
2439
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
2440
|
-
while(_)try {
|
|
2441
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
2442
|
-
if (y = 0, t) op = [
|
|
2443
|
-
op[0] & 2,
|
|
2444
|
-
t.value
|
|
2445
|
-
];
|
|
2446
|
-
switch(op[0]){
|
|
2447
|
-
case 0:
|
|
2448
|
-
case 1:
|
|
2449
|
-
t = op;
|
|
2450
|
-
break;
|
|
2451
|
-
case 4:
|
|
2452
|
-
_.label++;
|
|
2453
|
-
return {
|
|
2454
|
-
value: op[1],
|
|
2455
|
-
done: false
|
|
2456
|
-
};
|
|
2457
|
-
case 5:
|
|
2458
|
-
_.label++;
|
|
2459
|
-
y = op[1];
|
|
2460
|
-
op = [
|
|
2461
|
-
0
|
|
2462
|
-
];
|
|
2463
|
-
continue;
|
|
2464
|
-
case 7:
|
|
2465
|
-
op = _.ops.pop();
|
|
2466
|
-
_.trys.pop();
|
|
2467
|
-
continue;
|
|
2468
|
-
default:
|
|
2469
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
2470
|
-
_ = 0;
|
|
2471
|
-
continue;
|
|
2472
|
-
}
|
|
2473
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
2474
|
-
_.label = op[1];
|
|
2475
|
-
break;
|
|
2476
|
-
}
|
|
2477
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
2478
|
-
_.label = t[1];
|
|
2479
|
-
t = op;
|
|
2480
|
-
break;
|
|
2481
|
-
}
|
|
2482
|
-
if (t && _.label < t[2]) {
|
|
2483
|
-
_.label = t[2];
|
|
2484
|
-
_.ops.push(op);
|
|
2485
|
-
break;
|
|
2486
|
-
}
|
|
2487
|
-
if (t[2]) _.ops.pop();
|
|
2488
|
-
_.trys.pop();
|
|
2489
|
-
continue;
|
|
2490
|
-
}
|
|
2491
|
-
op = body.call(thisArg, _);
|
|
2492
|
-
} catch (e) {
|
|
2493
|
-
op = [
|
|
2494
|
-
6,
|
|
2495
|
-
e
|
|
2496
|
-
];
|
|
2497
|
-
y = 0;
|
|
2498
|
-
} finally{
|
|
2499
|
-
f = t = 0;
|
|
2500
|
-
}
|
|
2501
|
-
if (op[0] & 5) throw op[1];
|
|
2502
|
-
return {
|
|
2503
|
-
value: op[0] ? op[1] : void 0,
|
|
2504
|
-
done: true
|
|
2505
|
-
};
|
|
2506
|
-
}
|
|
2507
|
-
}
|
|
2508
|
-
var resolveProfileData = function() {
|
|
2509
|
-
var _ref = _async_to_generator$1(function(profileName, profiles, options, callerClientConfig) {
|
|
2510
|
-
var visitedProfiles, isAssumeRoleRecursiveCall, data;
|
|
2511
|
-
var _arguments = arguments;
|
|
2512
|
-
return _ts_generator$1(this, function(_state) {
|
|
2513
|
-
switch(_state.label){
|
|
2514
|
-
case 0:
|
|
2515
|
-
visitedProfiles = _arguments.length > 4 && _arguments[4] !== void 0 ? _arguments[4] : {}, isAssumeRoleRecursiveCall = _arguments.length > 5 && _arguments[5] !== void 0 ? _arguments[5] : false;
|
|
2516
|
-
data = profiles[profileName];
|
|
2517
|
-
if (Object.keys(visitedProfiles).length > 0 && isStaticCredsProfile(data)) {
|
|
2518
|
-
return [
|
|
2519
|
-
2,
|
|
2520
|
-
resolveStaticCredentials(data, options)
|
|
2521
|
-
];
|
|
2522
|
-
}
|
|
2523
|
-
if (isAssumeRoleRecursiveCall || isAssumeRoleProfile(data, {
|
|
2524
|
-
profile: profileName,
|
|
2525
|
-
logger: options.logger
|
|
2526
|
-
})) {
|
|
2527
|
-
return [
|
|
2528
|
-
2,
|
|
2529
|
-
resolveAssumeRoleCredentials(profileName, profiles, options, callerClientConfig, visitedProfiles, resolveProfileData)
|
|
2530
|
-
];
|
|
2531
|
-
}
|
|
2532
|
-
if (isStaticCredsProfile(data)) {
|
|
2533
|
-
return [
|
|
2534
|
-
2,
|
|
2535
|
-
resolveStaticCredentials(data, options)
|
|
2536
|
-
];
|
|
2537
|
-
}
|
|
2538
|
-
if (isWebIdentityProfile(data)) {
|
|
2539
|
-
return [
|
|
2540
|
-
2,
|
|
2541
|
-
resolveWebIdentityCredentials(data, options, callerClientConfig)
|
|
2542
|
-
];
|
|
2543
|
-
}
|
|
2544
|
-
if (isProcessProfile(data)) {
|
|
2545
|
-
return [
|
|
2546
|
-
2,
|
|
2547
|
-
resolveProcessCredentials(options, profileName)
|
|
2548
|
-
];
|
|
2549
|
-
}
|
|
2550
|
-
if (!isSsoProfile(data)) return [
|
|
2551
|
-
3,
|
|
2552
|
-
2
|
|
2553
|
-
];
|
|
2554
|
-
return [
|
|
2555
|
-
4,
|
|
2556
|
-
resolveSsoCredentials(profileName, data, options, callerClientConfig)
|
|
2557
|
-
];
|
|
2558
|
-
case 1:
|
|
2559
|
-
return [
|
|
2560
|
-
2,
|
|
2561
|
-
_state.sent()
|
|
2562
|
-
];
|
|
2563
|
-
case 2:
|
|
2564
|
-
if (isLoginProfile(data)) {
|
|
2565
|
-
return [
|
|
2566
|
-
2,
|
|
2567
|
-
resolveLoginCredentials(profileName, options, callerClientConfig)
|
|
2568
|
-
];
|
|
2569
|
-
}
|
|
2570
|
-
throw new CredentialsProviderError("Could not resolve credentials using profile: [".concat(profileName, "] in configuration/credentials file(s)."), {
|
|
2571
|
-
logger: options.logger
|
|
2572
|
-
});
|
|
2573
|
-
}
|
|
2574
|
-
});
|
|
2575
|
-
});
|
|
2576
|
-
return function resolveProfileData(profileName, profiles, options, callerClientConfig) {
|
|
2577
|
-
return _ref.apply(this, arguments);
|
|
2578
|
-
};
|
|
2579
|
-
}();
|
|
2580
|
-
|
|
2581
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2582
|
-
try {
|
|
2583
|
-
var info = gen[key](arg);
|
|
2584
|
-
var value = info.value;
|
|
2585
|
-
} catch (error) {
|
|
2586
|
-
reject(error);
|
|
2587
|
-
return;
|
|
2588
|
-
}
|
|
2589
|
-
if (info.done) {
|
|
2590
|
-
resolve(value);
|
|
2591
|
-
} else {
|
|
2592
|
-
Promise.resolve(value).then(_next, _throw);
|
|
2593
|
-
}
|
|
2594
|
-
}
|
|
2595
|
-
function _async_to_generator(fn) {
|
|
2596
|
-
return function() {
|
|
2597
|
-
var self = this, args = arguments;
|
|
2598
|
-
return new Promise(function(resolve, reject) {
|
|
2599
|
-
var gen = fn.apply(self, args);
|
|
2600
|
-
function _next(value) {
|
|
2601
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
2602
|
-
}
|
|
2603
|
-
function _throw(err) {
|
|
2604
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
2605
|
-
}
|
|
2606
|
-
_next(undefined);
|
|
448
|
+
});
|
|
2607
449
|
});
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
function _ts_generator(thisArg, body) {
|
|
2611
|
-
var f, y, t, g, _ = {
|
|
2612
|
-
label: 0,
|
|
2613
|
-
sent: function() {
|
|
2614
|
-
if (t[0] & 1) throw t[1];
|
|
2615
|
-
return t[1];
|
|
2616
|
-
},
|
|
2617
|
-
trys: [],
|
|
2618
|
-
ops: []
|
|
2619
|
-
};
|
|
2620
|
-
return g = {
|
|
2621
|
-
next: verb(0),
|
|
2622
|
-
"throw": verb(1),
|
|
2623
|
-
"return": verb(2)
|
|
2624
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
2625
|
-
return this;
|
|
2626
|
-
}), g;
|
|
2627
|
-
function verb(n) {
|
|
2628
|
-
return function(v) {
|
|
2629
|
-
return step([
|
|
2630
|
-
n,
|
|
2631
|
-
v
|
|
2632
|
-
]);
|
|
2633
|
-
};
|
|
2634
|
-
}
|
|
2635
|
-
function step(op) {
|
|
2636
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
2637
|
-
while(_)try {
|
|
2638
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
2639
|
-
if (y = 0, t) op = [
|
|
2640
|
-
op[0] & 2,
|
|
2641
|
-
t.value
|
|
2642
|
-
];
|
|
2643
|
-
switch(op[0]){
|
|
2644
|
-
case 0:
|
|
2645
|
-
case 1:
|
|
2646
|
-
t = op;
|
|
2647
|
-
break;
|
|
2648
|
-
case 4:
|
|
2649
|
-
_.label++;
|
|
2650
|
-
return {
|
|
2651
|
-
value: op[1],
|
|
2652
|
-
done: false
|
|
2653
|
-
};
|
|
2654
|
-
case 5:
|
|
2655
|
-
_.label++;
|
|
2656
|
-
y = op[1];
|
|
2657
|
-
op = [
|
|
2658
|
-
0
|
|
2659
|
-
];
|
|
2660
|
-
continue;
|
|
2661
|
-
case 7:
|
|
2662
|
-
op = _.ops.pop();
|
|
2663
|
-
_.trys.pop();
|
|
2664
|
-
continue;
|
|
2665
|
-
default:
|
|
2666
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
2667
|
-
_ = 0;
|
|
2668
|
-
continue;
|
|
2669
|
-
}
|
|
2670
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
2671
|
-
_.label = op[1];
|
|
2672
|
-
break;
|
|
2673
|
-
}
|
|
2674
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
2675
|
-
_.label = t[1];
|
|
2676
|
-
t = op;
|
|
2677
|
-
break;
|
|
2678
|
-
}
|
|
2679
|
-
if (t && _.label < t[2]) {
|
|
2680
|
-
_.label = t[2];
|
|
2681
|
-
_.ops.push(op);
|
|
2682
|
-
break;
|
|
2683
|
-
}
|
|
2684
|
-
if (t[2]) _.ops.pop();
|
|
2685
|
-
_.trys.pop();
|
|
2686
|
-
continue;
|
|
2687
|
-
}
|
|
2688
|
-
op = body.call(thisArg, _);
|
|
2689
|
-
} catch (e) {
|
|
2690
|
-
op = [
|
|
2691
|
-
6,
|
|
2692
|
-
e
|
|
2693
|
-
];
|
|
2694
|
-
y = 0;
|
|
2695
|
-
} finally{
|
|
2696
|
-
f = t = 0;
|
|
2697
|
-
}
|
|
2698
|
-
if (op[0] & 5) throw op[1];
|
|
2699
|
-
return {
|
|
2700
|
-
value: op[0] ? op[1] : void 0,
|
|
2701
|
-
done: true
|
|
450
|
+
return function(awsIdentityProperties) {
|
|
451
|
+
return _ref.apply(this, arguments);
|
|
2702
452
|
};
|
|
2703
|
-
}
|
|
2704
|
-
}
|
|
2705
|
-
var fromIni = function() {
|
|
2706
|
-
var init = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2707
|
-
return /*#__PURE__*/ _async_to_generator(function() {
|
|
2708
|
-
var callerClientConfig, _init_logger, profiles, _init_profile;
|
|
2709
|
-
var _arguments = arguments;
|
|
2710
|
-
return _ts_generator(this, function(_state) {
|
|
2711
|
-
switch(_state.label){
|
|
2712
|
-
case 0:
|
|
2713
|
-
callerClientConfig = (_arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {}).callerClientConfig;
|
|
2714
|
-
(_init_logger = init.logger) === null || _init_logger === void 0 ? void 0 : _init_logger.debug("@aws-sdk/credential-provider-ini - fromIni");
|
|
2715
|
-
return [
|
|
2716
|
-
4,
|
|
2717
|
-
parseKnownFiles(init)
|
|
2718
|
-
];
|
|
2719
|
-
case 1:
|
|
2720
|
-
profiles = _state.sent();
|
|
2721
|
-
return [
|
|
2722
|
-
2,
|
|
2723
|
-
resolveProfileData(getProfileName({
|
|
2724
|
-
profile: (_init_profile = init.profile) !== null && _init_profile !== void 0 ? _init_profile : callerClientConfig === null || callerClientConfig === void 0 ? void 0 : callerClientConfig.profile
|
|
2725
|
-
}), profiles, init, callerClientConfig)
|
|
2726
|
-
];
|
|
2727
|
-
}
|
|
2728
|
-
});
|
|
2729
|
-
});
|
|
453
|
+
}();
|
|
2730
454
|
};
|
|
2731
455
|
|
|
2732
|
-
export {
|
|
456
|
+
export { fromTokenFile, fromWebToken };
|