ibm-cloud-sdk-core 5.0.1 → 5.1.0
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/.secrets.baseline +128 -24
- package/Authentication.md +146 -21
- package/CHANGELOG.md +14 -0
- package/README.md +3 -2
- package/auth/authenticators/authenticator.d.ts +1 -0
- package/auth/authenticators/authenticator.js +1 -0
- package/auth/authenticators/basic-authenticator.d.ts +1 -1
- package/auth/authenticators/basic-authenticator.js +3 -1
- package/auth/authenticators/bearer-token-authenticator.js +2 -0
- package/auth/authenticators/container-authenticator.d.ts +6 -0
- package/auth/authenticators/container-authenticator.js +8 -0
- package/auth/authenticators/iam-assume-authenticator.d.ts +82 -0
- package/auth/authenticators/iam-assume-authenticator.js +92 -0
- package/auth/authenticators/iam-authenticator.d.ts +6 -0
- package/auth/authenticators/iam-authenticator.js +8 -0
- package/auth/authenticators/iam-request-based-authenticator-immutable.d.ts +64 -0
- package/auth/authenticators/iam-request-based-authenticator-immutable.js +74 -0
- package/auth/authenticators/iam-request-based-authenticator.d.ts +19 -47
- package/auth/authenticators/iam-request-based-authenticator.js +28 -36
- package/auth/authenticators/index.d.ts +4 -1
- package/auth/authenticators/index.js +3 -1
- package/auth/authenticators/token-request-based-authenticator-immutable.d.ts +71 -0
- package/auth/authenticators/token-request-based-authenticator-immutable.js +91 -0
- package/auth/authenticators/token-request-based-authenticator.d.ts +4 -42
- package/auth/authenticators/token-request-based-authenticator.js +5 -40
- package/auth/token-managers/container-token-manager.d.ts +6 -0
- package/auth/token-managers/container-token-manager.js +18 -50
- package/auth/token-managers/cp4d-token-manager.js +6 -1
- package/auth/token-managers/iam-assume-token-manager.d.ts +101 -0
- package/auth/token-managers/iam-assume-token-manager.js +220 -0
- package/auth/token-managers/iam-request-based-token-manager.d.ts +3 -9
- package/auth/token-managers/iam-request-based-token-manager.js +5 -9
- package/auth/token-managers/iam-token-manager.d.ts +8 -2
- package/auth/token-managers/iam-token-manager.js +10 -2
- package/auth/token-managers/index.d.ts +4 -2
- package/auth/token-managers/index.js +6 -3
- package/auth/token-managers/mcsp-token-manager.js +6 -1
- package/auth/token-managers/token-manager.js +7 -3
- package/auth/token-managers/vpc-instance-token-manager.js +4 -1
- package/auth/utils/get-authenticator-from-environment.js +3 -0
- package/auth/utils/helpers.d.ts +18 -23
- package/auth/utils/helpers.js +50 -30
- package/auth/utils/read-external-sources.js +2 -0
- package/docs/ibm-cloud-sdk-core.api.json +787 -404
- package/es/auth/authenticators/authenticator.d.ts +1 -0
- package/es/auth/authenticators/authenticator.js +1 -0
- package/es/auth/authenticators/basic-authenticator.d.ts +1 -1
- package/es/auth/authenticators/basic-authenticator.js +3 -1
- package/es/auth/authenticators/bearer-token-authenticator.js +2 -0
- package/es/auth/authenticators/container-authenticator.d.ts +6 -0
- package/es/auth/authenticators/container-authenticator.js +8 -0
- package/es/auth/authenticators/iam-assume-authenticator.d.ts +82 -0
- package/es/auth/authenticators/iam-assume-authenticator.js +70 -0
- package/es/auth/authenticators/iam-authenticator.d.ts +6 -0
- package/es/auth/authenticators/iam-authenticator.js +8 -0
- package/es/auth/authenticators/iam-request-based-authenticator-immutable.d.ts +64 -0
- package/es/auth/authenticators/iam-request-based-authenticator-immutable.js +51 -0
- package/es/auth/authenticators/iam-request-based-authenticator.d.ts +19 -47
- package/es/auth/authenticators/iam-request-based-authenticator.js +26 -35
- package/es/auth/authenticators/index.d.ts +4 -1
- package/es/auth/authenticators/index.js +1 -0
- package/es/auth/authenticators/token-request-based-authenticator-immutable.d.ts +71 -0
- package/es/auth/authenticators/token-request-based-authenticator-immutable.js +65 -0
- package/es/auth/authenticators/token-request-based-authenticator.d.ts +4 -42
- package/es/auth/authenticators/token-request-based-authenticator.js +3 -37
- package/es/auth/token-managers/container-token-manager.d.ts +6 -0
- package/es/auth/token-managers/container-token-manager.js +18 -24
- package/es/auth/token-managers/cp4d-token-manager.js +6 -1
- package/es/auth/token-managers/iam-assume-token-manager.d.ts +101 -0
- package/es/auth/token-managers/iam-assume-token-manager.js +164 -0
- package/es/auth/token-managers/iam-request-based-token-manager.d.ts +3 -9
- package/es/auth/token-managers/iam-request-based-token-manager.js +5 -9
- package/es/auth/token-managers/iam-token-manager.d.ts +8 -2
- package/es/auth/token-managers/iam-token-manager.js +10 -2
- package/es/auth/token-managers/index.d.ts +4 -2
- package/es/auth/token-managers/index.js +4 -2
- package/es/auth/token-managers/mcsp-token-manager.js +6 -1
- package/es/auth/token-managers/token-manager.js +7 -3
- package/es/auth/token-managers/vpc-instance-token-manager.js +4 -1
- package/es/auth/utils/get-authenticator-from-environment.js +4 -1
- package/es/auth/utils/helpers.d.ts +18 -23
- package/es/auth/utils/helpers.js +35 -27
- package/es/auth/utils/read-external-sources.js +2 -0
- package/es/lib/base-service.js +2 -0
- package/es/lib/private-helpers.d.ts +22 -0
- package/es/lib/private-helpers.js +58 -0
- package/es/lib/request-wrapper.d.ts +43 -1
- package/es/lib/request-wrapper.js +113 -14
- package/etc/ibm-cloud-sdk-core.api.md +46 -28
- package/ibm-cloud-sdk-core.d.ts +306 -68
- package/lib/base-service.js +2 -0
- package/lib/private-helpers.d.ts +22 -0
- package/lib/private-helpers.js +62 -0
- package/lib/request-wrapper.d.ts +43 -1
- package/lib/request-wrapper.js +113 -14
- package/package.json +5 -4
- package/sdk-test-utilities/package-lock.json +8 -5
- package/sdk-test-utilities/package.json +3 -0
package/.secrets.baseline
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"files": "package-lock.json|^.secrets.baseline$",
|
|
4
4
|
"lines": null
|
|
5
5
|
},
|
|
6
|
-
"generated_at": "2024-
|
|
6
|
+
"generated_at": "2024-10-10T20:59:14Z",
|
|
7
7
|
"plugins_used": [
|
|
8
8
|
{
|
|
9
9
|
"name": "AWSKeyDetector"
|
|
@@ -70,7 +70,39 @@
|
|
|
70
70
|
"hashed_secret": "91dfd9ddb4198affc5c194cd8ce6d338fde470e2",
|
|
71
71
|
"is_secret": false,
|
|
72
72
|
"is_verified": false,
|
|
73
|
-
"line_number":
|
|
73
|
+
"line_number": 75,
|
|
74
|
+
"type": "Secret Keyword",
|
|
75
|
+
"verified_result": null
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"hashed_secret": "4f51cde3ac0a5504afa4bc06859b098366592c19",
|
|
79
|
+
"is_secret": false,
|
|
80
|
+
"is_verified": false,
|
|
81
|
+
"line_number": 236,
|
|
82
|
+
"type": "Secret Keyword",
|
|
83
|
+
"verified_result": null
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"hashed_secret": "e87559ed7decb62d0733ae251ae58d42a55291d8",
|
|
87
|
+
"is_secret": false,
|
|
88
|
+
"is_verified": false,
|
|
89
|
+
"line_number": 238,
|
|
90
|
+
"type": "Secret Keyword",
|
|
91
|
+
"verified_result": null
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"hashed_secret": "12f4a68ed3d0863e56497c9cdb1e2e4e91d5cb68",
|
|
95
|
+
"is_secret": false,
|
|
96
|
+
"is_verified": false,
|
|
97
|
+
"line_number": 302,
|
|
98
|
+
"type": "Secret Keyword",
|
|
99
|
+
"verified_result": null
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"hashed_secret": "c837b75d7cd93ef9c2243ca28d6e5156259fd253",
|
|
103
|
+
"is_secret": false,
|
|
104
|
+
"is_verified": false,
|
|
105
|
+
"line_number": 306,
|
|
74
106
|
"type": "Secret Keyword",
|
|
75
107
|
"verified_result": null
|
|
76
108
|
},
|
|
@@ -78,7 +110,7 @@
|
|
|
78
110
|
"hashed_secret": "98635b2eaa2379f28cd6d72a38299f286b81b459",
|
|
79
111
|
"is_secret": false,
|
|
80
112
|
"is_verified": false,
|
|
81
|
-
"line_number":
|
|
113
|
+
"line_number": 558,
|
|
82
114
|
"type": "Secret Keyword",
|
|
83
115
|
"verified_result": null
|
|
84
116
|
},
|
|
@@ -86,7 +118,7 @@
|
|
|
86
118
|
"hashed_secret": "47fcf185ee7e15fe05cae31fbe9e4ebe4a06a40d",
|
|
87
119
|
"is_secret": false,
|
|
88
120
|
"is_verified": false,
|
|
89
|
-
"line_number":
|
|
121
|
+
"line_number": 668,
|
|
90
122
|
"type": "Secret Keyword",
|
|
91
123
|
"verified_result": null
|
|
92
124
|
}
|
|
@@ -96,7 +128,7 @@
|
|
|
96
128
|
"hashed_secret": "bc2f74c22f98f7b6ffbc2f67453dbfa99bce9a32",
|
|
97
129
|
"is_secret": false,
|
|
98
130
|
"is_verified": false,
|
|
99
|
-
"line_number":
|
|
131
|
+
"line_number": 214,
|
|
100
132
|
"type": "Secret Keyword",
|
|
101
133
|
"verified_result": null
|
|
102
134
|
}
|
|
@@ -116,7 +148,7 @@
|
|
|
116
148
|
"hashed_secret": "fdee05598fdd57ff8e9ae29e92c25a04f2c52fa6",
|
|
117
149
|
"is_secret": false,
|
|
118
150
|
"is_verified": false,
|
|
119
|
-
"line_number":
|
|
151
|
+
"line_number": 41,
|
|
120
152
|
"type": "Secret Keyword",
|
|
121
153
|
"verified_result": null
|
|
122
154
|
}
|
|
@@ -126,7 +158,7 @@
|
|
|
126
158
|
"hashed_secret": "bbccdf2efb33b52e6c9d0a14dd70b2d415fbea6e",
|
|
127
159
|
"is_secret": false,
|
|
128
160
|
"is_verified": false,
|
|
129
|
-
"line_number":
|
|
161
|
+
"line_number": 53,
|
|
130
162
|
"type": "Secret Keyword",
|
|
131
163
|
"verified_result": null
|
|
132
164
|
}
|
|
@@ -159,20 +191,22 @@
|
|
|
159
191
|
"verified_result": null
|
|
160
192
|
}
|
|
161
193
|
],
|
|
162
|
-
"auth/authenticators/iam-request-based-authenticator.ts": [
|
|
194
|
+
"auth/authenticators/iam-request-based-authenticator-immutable.ts": [
|
|
163
195
|
{
|
|
164
196
|
"hashed_secret": "f84f793e0af9ade37c8b927bc5091e98f35bf821",
|
|
165
197
|
"is_secret": false,
|
|
166
198
|
"is_verified": false,
|
|
167
|
-
"line_number":
|
|
199
|
+
"line_number": 81,
|
|
168
200
|
"type": "Secret Keyword",
|
|
169
201
|
"verified_result": null
|
|
170
|
-
}
|
|
202
|
+
}
|
|
203
|
+
],
|
|
204
|
+
"auth/authenticators/iam-request-based-authenticator.ts": [
|
|
171
205
|
{
|
|
172
206
|
"hashed_secret": "45c43fe97e3a06ab078b0eeff6fbe622cc417a25",
|
|
173
207
|
"is_secret": false,
|
|
174
208
|
"is_verified": false,
|
|
175
|
-
"line_number":
|
|
209
|
+
"line_number": 34,
|
|
176
210
|
"type": "Secret Keyword",
|
|
177
211
|
"verified_result": null
|
|
178
212
|
},
|
|
@@ -180,7 +214,7 @@
|
|
|
180
214
|
"hashed_secret": "99833a8b234b57b886a9aef1dba187fdd7ceece8",
|
|
181
215
|
"is_secret": false,
|
|
182
216
|
"is_verified": false,
|
|
183
|
-
"line_number":
|
|
217
|
+
"line_number": 36,
|
|
184
218
|
"type": "Secret Keyword",
|
|
185
219
|
"verified_result": null
|
|
186
220
|
}
|
|
@@ -210,7 +244,7 @@
|
|
|
210
244
|
"hashed_secret": "d5ff02fa48e492fac0a245ad63d1ae608e705c05",
|
|
211
245
|
"is_secret": false,
|
|
212
246
|
"is_verified": false,
|
|
213
|
-
"line_number":
|
|
247
|
+
"line_number": 99,
|
|
214
248
|
"type": "Secret Keyword",
|
|
215
249
|
"verified_result": null
|
|
216
250
|
},
|
|
@@ -218,7 +252,7 @@
|
|
|
218
252
|
"hashed_secret": "8f4bfc22c4fd7cb884f94ec175ff4a3284a174a1",
|
|
219
253
|
"is_secret": false,
|
|
220
254
|
"is_verified": false,
|
|
221
|
-
"line_number":
|
|
255
|
+
"line_number": 100,
|
|
222
256
|
"type": "Secret Keyword",
|
|
223
257
|
"verified_result": null
|
|
224
258
|
},
|
|
@@ -226,7 +260,7 @@
|
|
|
226
260
|
"hashed_secret": "45a15668db917c293f16e8add0f5d801889e5923",
|
|
227
261
|
"is_secret": false,
|
|
228
262
|
"is_verified": false,
|
|
229
|
-
"line_number":
|
|
263
|
+
"line_number": 117,
|
|
230
264
|
"type": "Secret Keyword",
|
|
231
265
|
"verified_result": null
|
|
232
266
|
},
|
|
@@ -234,7 +268,33 @@
|
|
|
234
268
|
"hashed_secret": "65e622227634e8876cfa733000233fb80c6f0473",
|
|
235
269
|
"is_secret": false,
|
|
236
270
|
"is_verified": false,
|
|
237
|
-
"line_number":
|
|
271
|
+
"line_number": 118,
|
|
272
|
+
"type": "Secret Keyword",
|
|
273
|
+
"verified_result": null
|
|
274
|
+
}
|
|
275
|
+
],
|
|
276
|
+
"auth/token-managers/iam-assume-token-manager.ts": [
|
|
277
|
+
{
|
|
278
|
+
"hashed_secret": "2ac283c95478b7355a84b60cd52c1722de2cbc3a",
|
|
279
|
+
"is_secret": false,
|
|
280
|
+
"is_verified": false,
|
|
281
|
+
"line_number": 111,
|
|
282
|
+
"type": "Secret Keyword",
|
|
283
|
+
"verified_result": null
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"hashed_secret": "faed0c503983c5ab06e19630096d39ebfafef86a",
|
|
287
|
+
"is_secret": false,
|
|
288
|
+
"is_verified": false,
|
|
289
|
+
"line_number": 115,
|
|
290
|
+
"type": "Secret Keyword",
|
|
291
|
+
"verified_result": null
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
"hashed_secret": "45c43fe97e3a06ab078b0eeff6fbe622cc417a25",
|
|
295
|
+
"is_secret": false,
|
|
296
|
+
"is_verified": false,
|
|
297
|
+
"line_number": 168,
|
|
238
298
|
"type": "Secret Keyword",
|
|
239
299
|
"verified_result": null
|
|
240
300
|
}
|
|
@@ -296,7 +356,7 @@
|
|
|
296
356
|
"hashed_secret": "8f4bfc22c4fd7cb884f94ec175ff4a3284a174a1",
|
|
297
357
|
"is_secret": false,
|
|
298
358
|
"is_verified": false,
|
|
299
|
-
"line_number":
|
|
359
|
+
"line_number": 80,
|
|
300
360
|
"type": "Secret Keyword",
|
|
301
361
|
"verified_result": null
|
|
302
362
|
},
|
|
@@ -304,7 +364,7 @@
|
|
|
304
364
|
"hashed_secret": "65e622227634e8876cfa733000233fb80c6f0473",
|
|
305
365
|
"is_secret": false,
|
|
306
366
|
"is_verified": false,
|
|
307
|
-
"line_number":
|
|
367
|
+
"line_number": 96,
|
|
308
368
|
"type": "Secret Keyword",
|
|
309
369
|
"verified_result": null
|
|
310
370
|
}
|
|
@@ -314,7 +374,7 @@
|
|
|
314
374
|
"hashed_secret": "6947818ac409551f11fbaa78f0ea6391960aa5b8",
|
|
315
375
|
"is_secret": false,
|
|
316
376
|
"is_verified": false,
|
|
317
|
-
"line_number":
|
|
377
|
+
"line_number": 51,
|
|
318
378
|
"type": "Secret Keyword",
|
|
319
379
|
"verified_result": null
|
|
320
380
|
}
|
|
@@ -334,7 +394,7 @@
|
|
|
334
394
|
"hashed_secret": "45c43fe97e3a06ab078b0eeff6fbe622cc417a25",
|
|
335
395
|
"is_secret": false,
|
|
336
396
|
"is_verified": false,
|
|
337
|
-
"line_number":
|
|
397
|
+
"line_number": 286,
|
|
338
398
|
"type": "Secret Keyword",
|
|
339
399
|
"verified_result": null
|
|
340
400
|
}
|
|
@@ -442,7 +502,7 @@
|
|
|
442
502
|
"hashed_secret": "1572bd30ac06678a82df42b5913e5e52e27f9a12",
|
|
443
503
|
"is_secret": false,
|
|
444
504
|
"is_verified": false,
|
|
445
|
-
"line_number":
|
|
505
|
+
"line_number": 32,
|
|
446
506
|
"type": "Secret Keyword",
|
|
447
507
|
"verified_result": null
|
|
448
508
|
},
|
|
@@ -450,7 +510,51 @@
|
|
|
450
510
|
"hashed_secret": "16856d955c788df03735a24feb2e3ffefd91f3dc",
|
|
451
511
|
"is_secret": false,
|
|
452
512
|
"is_verified": false,
|
|
453
|
-
"line_number":
|
|
513
|
+
"line_number": 33,
|
|
514
|
+
"type": "Secret Keyword",
|
|
515
|
+
"verified_result": null
|
|
516
|
+
}
|
|
517
|
+
],
|
|
518
|
+
"test/unit/iam-assume-authenticator.test.js": [
|
|
519
|
+
{
|
|
520
|
+
"hashed_secret": "9cea46b39bd44a1ef9f3e71bfe9e45c24d3300f6",
|
|
521
|
+
"is_secret": false,
|
|
522
|
+
"is_verified": false,
|
|
523
|
+
"line_number": 33,
|
|
524
|
+
"type": "Secret Keyword",
|
|
525
|
+
"verified_result": null
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
"hashed_secret": "5c5a15a8b0b3e154d77746945e563ba40100681b",
|
|
529
|
+
"is_secret": false,
|
|
530
|
+
"is_verified": false,
|
|
531
|
+
"line_number": 37,
|
|
532
|
+
"type": "Secret Keyword",
|
|
533
|
+
"verified_result": null
|
|
534
|
+
}
|
|
535
|
+
],
|
|
536
|
+
"test/unit/iam-assume-token-manager.test.js": [
|
|
537
|
+
{
|
|
538
|
+
"hashed_secret": "a0da30f332dd7b7a26d1c0b4da5437fcd90bf49b",
|
|
539
|
+
"is_secret": false,
|
|
540
|
+
"is_verified": false,
|
|
541
|
+
"line_number": 33,
|
|
542
|
+
"type": "Secret Keyword",
|
|
543
|
+
"verified_result": null
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
"hashed_secret": "9cea46b39bd44a1ef9f3e71bfe9e45c24d3300f6",
|
|
547
|
+
"is_secret": false,
|
|
548
|
+
"is_verified": false,
|
|
549
|
+
"line_number": 150,
|
|
550
|
+
"type": "Secret Keyword",
|
|
551
|
+
"verified_result": null
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
"hashed_secret": "43ed4c2d8375dfc89e3dc8c917f404b9481d355b",
|
|
555
|
+
"is_secret": false,
|
|
556
|
+
"is_verified": false,
|
|
557
|
+
"line_number": 404,
|
|
454
558
|
"type": "Secret Keyword",
|
|
455
559
|
"verified_result": null
|
|
456
560
|
}
|
|
@@ -522,7 +626,7 @@
|
|
|
522
626
|
"hashed_secret": "a7ef1be18bb8d37af79f3d87761a203378bf26a2",
|
|
523
627
|
"is_secret": false,
|
|
524
628
|
"is_verified": false,
|
|
525
|
-
"line_number":
|
|
629
|
+
"line_number": 158,
|
|
526
630
|
"type": "Secret Keyword",
|
|
527
631
|
"verified_result": null
|
|
528
632
|
}
|
|
@@ -542,7 +646,7 @@
|
|
|
542
646
|
"hashed_secret": "f2e7745f43b0ef0e2c2faf61d6c6a28be2965750",
|
|
543
647
|
"is_secret": false,
|
|
544
648
|
"is_verified": false,
|
|
545
|
-
"line_number":
|
|
649
|
+
"line_number": 31,
|
|
546
650
|
"type": "Secret Keyword",
|
|
547
651
|
"verified_result": null
|
|
548
652
|
}
|
package/Authentication.md
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
The node-sdk-core project supports the following types of authentication:
|
|
3
3
|
- Basic Authentication
|
|
4
4
|
- Bearer Token Authentication
|
|
5
|
-
- Identity and Access Management (IAM) Authentication
|
|
5
|
+
- Identity and Access Management (IAM) Authentication (grant type: apikey)
|
|
6
|
+
- Identity and Access Management (IAM) Authentication (grant type: assume)
|
|
6
7
|
- Container Authentication
|
|
7
8
|
- VPC Instance Authentication
|
|
8
9
|
- Cloud Pak for Data Authentication
|
|
@@ -16,7 +17,7 @@ which authentication types are supported for that service.
|
|
|
16
17
|
|
|
17
18
|
The node-sdk-core allows an authenticator to be specified in one of two ways:
|
|
18
19
|
1. programmatically - the SDK user invokes the appropriate function(s) to create an instance of the
|
|
19
|
-
desired authenticator and then passes the authenticator instance when constructing an instance of the service.
|
|
20
|
+
desired authenticator and then passes the authenticator instance when constructing an instance of the service client.
|
|
20
21
|
2. configuration - the SDK user provides external configuration information (in the form of environment variables
|
|
21
22
|
or a credentials file) to indicate the type of authenticator, along with the configuration of the necessary properties
|
|
22
23
|
for that authenticator. The SDK user then invokes the configuration-based authenticator factory to construct an instance
|
|
@@ -28,7 +29,7 @@ which will include the following:
|
|
|
28
29
|
- The properties associated with the authenticator
|
|
29
30
|
- An example of how to construct the authenticator programmatically
|
|
30
31
|
- An example of how to configure the authenticator through the use of external
|
|
31
|
-
configuration information.
|
|
32
|
+
configuration information. The configuration examples below will use
|
|
32
33
|
environment variables, although the same properties could be specified in a
|
|
33
34
|
credentials file instead.
|
|
34
35
|
|
|
@@ -143,16 +144,16 @@ const service = ExampleServiceV1.newInstance(options);
|
|
|
143
144
|
|
|
144
145
|
Note that the use of external configuration is not as useful with the `BearerTokenAuthenticator` as it
|
|
145
146
|
is for other authenticator types because bearer tokens typically need to be obtained and refreshed
|
|
146
|
-
programmatically since they normally have a relatively short lifespan before they expire.
|
|
147
|
+
programmatically since they normally have a relatively short lifespan before they expire. This
|
|
147
148
|
authenticator type is intended for situations in which the application will be managing the bearer
|
|
148
149
|
token itself in terms of initial acquisition and refreshing as needed.
|
|
149
150
|
|
|
150
151
|
|
|
151
|
-
## Identity and Access Management (IAM) Authentication
|
|
152
|
-
The `IamAuthenticator` will accept a user-supplied
|
|
152
|
+
## Identity and Access Management (IAM) Authentication (grant type: apikey)
|
|
153
|
+
The `IamAuthenticator` will accept a user-supplied apikey and will perform
|
|
153
154
|
the necessary interactions with the IAM token service to obtain a suitable
|
|
154
|
-
bearer token for the specified
|
|
155
|
-
a new bearer token when the current token expires.
|
|
155
|
+
bearer token for the specified apikey. The authenticator will also obtain
|
|
156
|
+
a new bearer token when the current token expires. The bearer token is
|
|
156
157
|
then added to each outbound request in the `Authorization` header in the
|
|
157
158
|
form:
|
|
158
159
|
```
|
|
@@ -161,7 +162,7 @@ form:
|
|
|
161
162
|
|
|
162
163
|
### Properties
|
|
163
164
|
|
|
164
|
-
- apikey: (required) the IAM
|
|
165
|
+
- apikey: (required) the IAM apikey to be used to obtain an IAM access token.
|
|
165
166
|
|
|
166
167
|
- url: (optional) The base endpoint URL of the IAM token service.
|
|
167
168
|
The default value of this property is the "prod" IAM token service endpoint
|
|
@@ -178,13 +179,13 @@ endpoint as well (`https://iam.test.cloud.ibm.com`).
|
|
|
178
179
|
|
|
179
180
|
- clientId/clientSecret: (optional) The `clientId` and `clientSecret` fields are used to form a
|
|
180
181
|
"basic auth" Authorization header for interactions with the IAM token server. If neither field
|
|
181
|
-
is specified, then no Authorization header will be sent with token server requests.
|
|
182
|
+
is specified, then no Authorization header will be sent with token server requests. These fields
|
|
182
183
|
are optional, but must be specified together.
|
|
183
184
|
|
|
184
185
|
- scope: (optional) the scope to be associated with the IAM access token.
|
|
185
186
|
If not specified, then no scope wil be associated with the access token.
|
|
186
187
|
|
|
187
|
-
- disableSslVerification: (optional) A flag that indicates whether
|
|
188
|
+
- disableSslVerification: (optional) A flag that indicates whether verification of the server's SSL
|
|
188
189
|
certificate should be disabled or not. The default value is `false`.
|
|
189
190
|
|
|
190
191
|
- headers: (optional) A set of key/value pairs that will be sent as HTTP headers in requests
|
|
@@ -228,6 +229,130 @@ const service = ExampleServiceV1.newInstance(options);
|
|
|
228
229
|
```
|
|
229
230
|
|
|
230
231
|
|
|
232
|
+
## Identity and Access Management (IAM) Authentication (grant type: assume)
|
|
233
|
+
The `IamAssumeAuthenticator` performs a two-step token fetch sequence to obtain
|
|
234
|
+
a bearer token that allows the application to assume the identity of a trusted profile:
|
|
235
|
+
1. First, the authenticator obtains an initial bearer token using grant type
|
|
236
|
+
`urn:ibm:params:oauth:grant-type:apikey`.
|
|
237
|
+
This initial token will reflect the identity associated with the input apikey.
|
|
238
|
+
2. Second, the authenticator uses the grant type `urn:ibm:params:oauth:grant-type:assume` to obtain a bearer token
|
|
239
|
+
that reflects the identity of the trusted profile, passing in the initial bearer token
|
|
240
|
+
from the first step, along with the trusted profile-related inputs.
|
|
241
|
+
|
|
242
|
+
The authenticator will also obtain a new bearer token when the current token expires.
|
|
243
|
+
The bearer token is then added to each outbound request in the `Authorization` header in the
|
|
244
|
+
form:
|
|
245
|
+
```
|
|
246
|
+
Authorization: Bearer <bearer-token>
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### Properties
|
|
250
|
+
|
|
251
|
+
- apikey: (required) the IAM apikey to be used to obtain the initial IAM access token.
|
|
252
|
+
|
|
253
|
+
- iamProfileCrn: (optional) the Cloud Resource Name (CRN) associated with the trusted profile
|
|
254
|
+
for which an access token should be fetched.
|
|
255
|
+
Exactly one of iamProfileCrn, iamProfileId or iamProfileName must be specified.
|
|
256
|
+
|
|
257
|
+
- iamProfileId: (optional) the ID associated with the trusted profile
|
|
258
|
+
for which an access token should be fetched.
|
|
259
|
+
Exactly one of iamProfileCrn, iamProfileId or iamProfileName must be specified.
|
|
260
|
+
|
|
261
|
+
- iamProfileName: (optional) the name associated with the trusted profile
|
|
262
|
+
for which an access token should be fetched. When specifying this property, you must also
|
|
263
|
+
specify the iamAccountId property as well.
|
|
264
|
+
Exactly one of iamProfileCrn, iamProfileId or iamProfileName must be specified.
|
|
265
|
+
|
|
266
|
+
- iamAccountId: (optional) the ID associated with the IAM account that contains the trusted profile
|
|
267
|
+
referenced by the iamProfileName property. The imaAccountId property must be specified if and only if
|
|
268
|
+
the iamProfileName property is specified.
|
|
269
|
+
|
|
270
|
+
- url: (optional) The base endpoint URL of the IAM token service.
|
|
271
|
+
The default value of this property is the "prod" IAM token service endpoint
|
|
272
|
+
(`https://iam.cloud.ibm.com`).
|
|
273
|
+
Make sure that you use an IAM token service endpoint that is appropriate for the
|
|
274
|
+
location of the service being used by your application.
|
|
275
|
+
For example, if you are using an instance of a service in the "production" environment
|
|
276
|
+
(e.g. `https://resource-controller.cloud.ibm.com`),
|
|
277
|
+
then the default "prod" IAM token service endpoint should suffice.
|
|
278
|
+
However, if your application is using an instance of a service in the "staging" environment
|
|
279
|
+
(e.g. `https://resource-controller.test.cloud.ibm.com`),
|
|
280
|
+
then you would also need to configure the authenticator to use the IAM token service "staging"
|
|
281
|
+
endpoint as well (`https://iam.test.cloud.ibm.com`).
|
|
282
|
+
|
|
283
|
+
- clientId/clientSecret: (optional) The `clientId` and `clientSecret` fields are used to form a
|
|
284
|
+
"basic auth" Authorization header for interactions with the IAM token server when fetching the
|
|
285
|
+
initial IAM access token. These fields are optional, but must be specified together.
|
|
286
|
+
|
|
287
|
+
- scope: (optional) the scope to be used when obtaining the initial IAM access token.
|
|
288
|
+
If not specified, then no scope will be associated with the access token.
|
|
289
|
+
|
|
290
|
+
- disableSslVerification: (optional) A flag that indicates whether verification of the server's SSL
|
|
291
|
+
certificate should be disabled or not. The default value is `false`.
|
|
292
|
+
|
|
293
|
+
- headers: (optional) A set of key/value pairs that will be sent as HTTP headers in requests
|
|
294
|
+
made to the IAM token service.
|
|
295
|
+
|
|
296
|
+
### Usage Notes
|
|
297
|
+
- The IamAssumeAuthenticator is used to obtain an access token (a bearer token) from the IAM token service
|
|
298
|
+
that allows an application to "assume" the identity of a trusted profile.
|
|
299
|
+
|
|
300
|
+
- The authenticator first uses the apikey, url, clientId/clientSecret, scope, disableSslVerification, and headers
|
|
301
|
+
properties to obtain an initial access token by invoking the IAM `getToken`
|
|
302
|
+
(grant_type=`urn:ibm:params:oauth:grant-type:apikey`) operation.
|
|
303
|
+
|
|
304
|
+
- The authenticator then uses the initial access token along with the url, iamProfileCrn, iamProfileId,
|
|
305
|
+
iamProfileName, iamAccountId, disableSSLVerification, and headers properties to obtain an access token by invoking
|
|
306
|
+
the IAM `getToken` (grant_type=`urn:ibm:params:oauth:grant-type:assume`) operation.
|
|
307
|
+
The access token resulting from this second step will reflect the identity of the specified trusted profile.
|
|
308
|
+
|
|
309
|
+
- When providing the trusted profile information, you must specify exactly one of: iamProfileCrn, iamProfileId
|
|
310
|
+
or iamProfileName. If you specify iamProfileCrn or iamProfileId, then the trusted profile must exist in the same account that is
|
|
311
|
+
associated with the input apikey. If you specify iamProfileName, then you must also specify the iamAccountId property
|
|
312
|
+
to indicate the IAM account in which the named trusted profile can be found.
|
|
313
|
+
|
|
314
|
+
### Programming example
|
|
315
|
+
```js
|
|
316
|
+
const { IamAssumeAuthenticator } = require('ibm-cloud-sdk-core');
|
|
317
|
+
const ExampleServiceV1 = require('<sdk-package-name>/example-service/v1');
|
|
318
|
+
|
|
319
|
+
// Create the authenticator.
|
|
320
|
+
const authenticator = new IamAssumeAuthenticator({
|
|
321
|
+
apikey: 'myapikey',
|
|
322
|
+
iamProfileId: 'myprofile-1',
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
const options = {
|
|
326
|
+
authenticator,
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
// Create the service instance.
|
|
330
|
+
const service = new ExampleServiceV1(options);
|
|
331
|
+
|
|
332
|
+
// 'service' can now be used to invoke operations.
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
### Configuration example
|
|
336
|
+
External configuration:
|
|
337
|
+
```
|
|
338
|
+
export EXAMPLE_SERVICE_AUTH_TYPE=iamAssume
|
|
339
|
+
export EXAMPLE_SERVICE_APIKEY=myapikey
|
|
340
|
+
export EXAMPLE_SERVICE_IAM_PROFILE_ID=myprofile-1
|
|
341
|
+
```
|
|
342
|
+
Application code:
|
|
343
|
+
```js
|
|
344
|
+
const ExampleServiceV1 = require('<sdk-package-name>/example-service/v1');
|
|
345
|
+
|
|
346
|
+
const options = {
|
|
347
|
+
serviceName: 'example_service',
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
const service = ExampleServiceV1.newInstance(options);
|
|
351
|
+
|
|
352
|
+
// 'service' can now be used to invoke operations.
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
|
|
231
356
|
## Container Authentication
|
|
232
357
|
The `ContainerAuthenticator` is intended to be used by application code
|
|
233
358
|
running inside a compute resource managed by the IBM Kubernetes Service (IKS)
|
|
@@ -236,7 +361,7 @@ within the compute resource's local file system.
|
|
|
236
361
|
The CR token is similar to an IAM apikey except that it is managed automatically by
|
|
237
362
|
the compute resource provider (IKS).
|
|
238
363
|
This allows the application developer to:
|
|
239
|
-
- avoid storing credentials in application code,
|
|
364
|
+
- avoid storing credentials in application code, configuration files or a password vault
|
|
240
365
|
- avoid managing or rotating credentials
|
|
241
366
|
|
|
242
367
|
The `ContainerAuthenticator` will retrieve the CR token from
|
|
@@ -280,13 +405,13 @@ endpoint as well (`https://iam.test.cloud.ibm.com`).
|
|
|
280
405
|
|
|
281
406
|
- clientId/clientSecret: (optional) The `clientId` and `clientSecret` fields are used to form a
|
|
282
407
|
"basic auth" Authorization header for interactions with the IAM token service. If neither field
|
|
283
|
-
is specified, then no Authorization header will be sent with token server requests.
|
|
408
|
+
is specified, then no Authorization header will be sent with token server requests. These fields
|
|
284
409
|
are optional, but must be specified together.
|
|
285
410
|
|
|
286
411
|
- scope: (optional) the scope to be associated with the IAM access token.
|
|
287
412
|
If not specified, then no scope will be associated with the access token.
|
|
288
413
|
|
|
289
|
-
- disableSslVerification: (optional) A flag that indicates whether
|
|
414
|
+
- disableSslVerification: (optional) A flag that indicates whether verification of the server's SSL
|
|
290
415
|
certificate should be disabled or not. The default value is `false`.
|
|
291
416
|
|
|
292
417
|
- headers: (optional) A set of key/value pairs that will be sent as HTTP headers in requests
|
|
@@ -342,7 +467,7 @@ The compute resource identity feature allows you to assign a trusted IAM profile
|
|
|
342
467
|
This, in turn, allows applications running within the compute resource to take on this identity when interacting with
|
|
343
468
|
IAM-secured IBM Cloud services.
|
|
344
469
|
This results in a simplified security model that allows the application developer to:
|
|
345
|
-
- avoid storing credentials in application code,
|
|
470
|
+
- avoid storing credentials in application code, configuration files or a password vault
|
|
346
471
|
- avoid managing or rotating credentials
|
|
347
472
|
|
|
348
473
|
The `VpcInstanceAuthenticator` will invoke the appropriate operations on the compute resource's locally-available
|
|
@@ -361,11 +486,11 @@ The IAM access token is added to each outbound request in the `Authorization` he
|
|
|
361
486
|
- iamProfileId: (optional) the id of the linked trusted IAM profile to be used when obtaining the IAM access token.
|
|
362
487
|
|
|
363
488
|
- url: (optional) The VPC Instance Metadata Service's base URL.
|
|
364
|
-
The default value of this property is `http://169.254.169.254`.
|
|
489
|
+
The default value of this property is `http://169.254.169.254`. However, if the VPC Instance Metadata Service is configured
|
|
365
490
|
with the HTTP Secure Protocol setting (`https`), then you should configure this property to be `https://api.metadata.cloud.ibm.com`.
|
|
366
491
|
|
|
367
492
|
Usage Notes:
|
|
368
|
-
1. At most one of `iamProfileCrn` or `iamProfileId` may be specified.
|
|
493
|
+
1. At most one of `iamProfileCrn` or `iamProfileId` may be specified. The specified value must map
|
|
369
494
|
to a trusted IAM profile that has been linked to the compute resource (virtual server instance).
|
|
370
495
|
|
|
371
496
|
2. If both `iamProfileCrn` and `iamProfileId` are specified, then an error occurs.
|
|
@@ -413,11 +538,11 @@ const service = ExampleServiceV1.newInstance(options);
|
|
|
413
538
|
```
|
|
414
539
|
|
|
415
540
|
|
|
416
|
-
##
|
|
541
|
+
## Cloud Pak for Data Authentication
|
|
417
542
|
The `CloudPakForDataAuthenticator` will accept a user-supplied username value, along with either a
|
|
418
543
|
password or apikey, and will
|
|
419
544
|
perform the necessary interactions with the Cloud Pak for Data token service to obtain a suitable
|
|
420
|
-
bearer token.
|
|
545
|
+
bearer token. The authenticator will also obtain a new bearer token when the current token expires.
|
|
421
546
|
The bearer token is then added to each outbound request in the `Authorization` header in the
|
|
422
547
|
form:
|
|
423
548
|
```
|
|
@@ -436,7 +561,7 @@ Exactly one of password or apikey should be specified.
|
|
|
436
561
|
- url: (required) The URL representing the Cloud Pak for Data token service endpoint's base URL string.
|
|
437
562
|
This value should not include the `/v1/authorize` path portion.
|
|
438
563
|
|
|
439
|
-
- disableSslVerification: (optional) A flag that indicates whether
|
|
564
|
+
- disableSslVerification: (optional) A flag that indicates whether verification of the server's SSL
|
|
440
565
|
certificate should be disabled or not. The default value is `false`.
|
|
441
566
|
|
|
442
567
|
- headers: (optional) A set of key/value pairs that will be sent as HTTP headers in requests
|
|
@@ -505,7 +630,7 @@ form:
|
|
|
505
630
|
- url: (required) The URL representing the MCSP token service endpoint's base URL string. Do not include the
|
|
506
631
|
operation path (e.g. `/siusermgr/api/1.0/apikeys/token`) as part of this property's value.
|
|
507
632
|
|
|
508
|
-
- disableSSLVerification: (optional) A flag that indicates whether
|
|
633
|
+
- disableSSLVerification: (optional) A flag that indicates whether verification of the server's SSL
|
|
509
634
|
certificate should be disabled or not. The default value is `false`.
|
|
510
635
|
|
|
511
636
|
- headers: (optional) A set of key/value pairs that will be sent as HTTP headers in requests
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [5.1.0](https://github.com/IBM/node-sdk-core/compare/v5.0.2...v5.1.0) (2024-10-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **IamAssumeAuthenticator:** add new authentication type for iam assume ([#287](https://github.com/IBM/node-sdk-core/issues/287)) ([addebfc](https://github.com/IBM/node-sdk-core/commit/addebfca36f0b45a1e4df18605984a66073413bb))
|
|
7
|
+
|
|
8
|
+
## [5.0.2](https://github.com/IBM/node-sdk-core/compare/v5.0.1...v5.0.2) (2024-09-03)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **logging:** improve node core's debug logging ([#286](https://github.com/IBM/node-sdk-core/issues/286)) ([7bcb404](https://github.com/IBM/node-sdk-core/commit/7bcb404fa88592079571149c4b4224f97798f47d))
|
|
14
|
+
|
|
1
15
|
## [5.0.1](https://github.com/IBM/node-sdk-core/compare/v5.0.0...v5.0.1) (2024-08-14)
|
|
2
16
|
|
|
3
17
|
|
package/README.md
CHANGED
|
@@ -30,7 +30,8 @@ class YourSDK extends BaseService { ... }
|
|
|
30
30
|
The node-sdk-core project supports the following types of authentication:
|
|
31
31
|
- Basic Authentication
|
|
32
32
|
- Bearer Token Authentication
|
|
33
|
-
- Identity and Access Management (IAM) Authentication
|
|
33
|
+
- Identity and Access Management (IAM) Authentication (grant type: apikey)
|
|
34
|
+
- Identity and Access Management (IAM) Authentication (grant type: assume)
|
|
34
35
|
- Container Authentication
|
|
35
36
|
- VPC Instance Authentication
|
|
36
37
|
- Cloud Pak for Data Authentication
|
|
@@ -79,7 +80,7 @@ To see the output from all of the debugging levels you can use:
|
|
|
79
80
|
|
|
80
81
|
``DEBUG=ibm-cloud-sdk-core*``
|
|
81
82
|
|
|
82
|
-
The debug logger can be configured to be used for more than one library.
|
|
83
|
+
The debug logger can be configured to be used for more than one library. For example, you can set a comma-separated string:
|
|
83
84
|
|
|
84
85
|
``DEBUG=ibm-cloud-sdk-core:debug,other-lib:debug``
|
|
85
86
|
|
|
@@ -25,6 +25,7 @@ export declare class Authenticator implements AuthenticatorInterface {
|
|
|
25
25
|
static AUTHTYPE_BASIC: string;
|
|
26
26
|
static AUTHTYPE_BEARERTOKEN: string;
|
|
27
27
|
static AUTHTYPE_IAM: string;
|
|
28
|
+
static AUTHTYPE_IAM_ASSUME: string;
|
|
28
29
|
static AUTHTYPE_CONTAINER: string;
|
|
29
30
|
static AUTHTYPE_CP4D: string;
|
|
30
31
|
static AUTHTYPE_NOAUTH: string;
|
|
@@ -47,6 +47,7 @@ var Authenticator = /** @class */ (function () {
|
|
|
47
47
|
Authenticator.AUTHTYPE_BASIC = 'basic';
|
|
48
48
|
Authenticator.AUTHTYPE_BEARERTOKEN = 'bearerToken';
|
|
49
49
|
Authenticator.AUTHTYPE_IAM = 'iam';
|
|
50
|
+
Authenticator.AUTHTYPE_IAM_ASSUME = 'iamAssume';
|
|
50
51
|
Authenticator.AUTHTYPE_CONTAINER = 'container';
|
|
51
52
|
Authenticator.AUTHTYPE_CP4D = 'cp4d';
|
|
52
53
|
Authenticator.AUTHTYPE_NOAUTH = 'noAuth';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* (C) Copyright IBM Corp. 2019,
|
|
3
|
+
* (C) Copyright IBM Corp. 2019, 2024.
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
* you may not use this file except in compliance with the License.
|
|
@@ -37,6 +37,7 @@ exports.BasicAuthenticator = void 0;
|
|
|
37
37
|
var extend_1 = __importDefault(require("extend"));
|
|
38
38
|
var helpers_1 = require("../utils/helpers");
|
|
39
39
|
var authenticator_1 = require("./authenticator");
|
|
40
|
+
var logger_1 = __importDefault(require("../../lib/logger"));
|
|
40
41
|
/**
|
|
41
42
|
* The BasicAuthenticator is used to add basic authentication information to
|
|
42
43
|
* requests.
|
|
@@ -79,6 +80,7 @@ var BasicAuthenticator = /** @class */ (function (_super) {
|
|
|
79
80
|
var _this = this;
|
|
80
81
|
return new Promise(function (resolve) {
|
|
81
82
|
requestOptions.headers = (0, extend_1.default)(true, {}, requestOptions.headers, _this.authHeader);
|
|
83
|
+
logger_1.default.debug("Authenticated outbound request (type=".concat(_this.authenticationType(), ")"));
|
|
82
84
|
resolve();
|
|
83
85
|
});
|
|
84
86
|
};
|