ibm-cloud-sdk-core 2.11.2 → 2.12.2
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 +103 -50
- package/Authentication.md +66 -3
- package/CHANGELOG.md +28 -0
- package/README.md +1 -0
- package/auth/authenticators/container-authenticator.d.ts +78 -0
- package/auth/authenticators/container-authenticator.js +105 -0
- package/auth/authenticators/iam-authenticator.d.ts +3 -33
- package/auth/authenticators/iam-authenticator.js +2 -27
- package/auth/authenticators/iam-request-based-authenticator.d.ts +77 -0
- package/auth/authenticators/iam-request-based-authenticator.js +93 -0
- package/auth/authenticators/index.d.ts +4 -0
- package/auth/authenticators/index.js +4 -0
- package/auth/token-managers/container-token-manager.d.ts +75 -0
- package/auth/token-managers/container-token-manager.js +168 -0
- package/auth/token-managers/iam-request-based-token-manager.d.ts +80 -0
- package/auth/token-managers/iam-request-based-token-manager.js +148 -0
- package/auth/token-managers/iam-token-manager.d.ts +3 -36
- package/auth/token-managers/iam-token-manager.js +6 -111
- package/auth/token-managers/index.d.ts +6 -2
- package/auth/token-managers/index.js +8 -2
- package/auth/utils/{read-credentials-file.browser.d.ts → file-reading-helpers.browser.d.ts} +1 -0
- package/auth/utils/{read-credentials-file.browser.js → file-reading-helpers.browser.js} +4 -0
- package/auth/utils/{read-credentials-file.d.ts → file-reading-helpers.d.ts} +3 -2
- package/auth/utils/{read-credentials-file.js → file-reading-helpers.js} +27 -3
- package/auth/utils/get-authenticator-from-environment.js +11 -2
- package/auth/utils/helpers.d.ts +29 -0
- package/auth/utils/helpers.js +41 -0
- package/auth/utils/index.d.ts +1 -1
- package/auth/utils/index.js +1 -1
- package/auth/utils/read-external-sources.js +2 -2
- package/lib/querystring.js +3 -12
- package/package.json +1 -1
- package/index.html +0 -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": "2021-
|
|
6
|
+
"generated_at": "2021-08-05T20:39:19Z",
|
|
7
7
|
"plugins_used": [
|
|
8
8
|
{
|
|
9
9
|
"name": "AWSKeyDetector"
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"name": "CloudantDetector"
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
|
+
"ghe_instance": "github.ibm.com",
|
|
28
29
|
"name": "GheDetector"
|
|
29
30
|
},
|
|
30
31
|
{
|
|
@@ -69,7 +70,7 @@
|
|
|
69
70
|
"hashed_secret": "91dfd9ddb4198affc5c194cd8ce6d338fde470e2",
|
|
70
71
|
"is_secret": false,
|
|
71
72
|
"is_verified": false,
|
|
72
|
-
"line_number":
|
|
73
|
+
"line_number": 57,
|
|
73
74
|
"type": "Secret Keyword",
|
|
74
75
|
"verified_result": null
|
|
75
76
|
},
|
|
@@ -77,7 +78,23 @@
|
|
|
77
78
|
"hashed_secret": "47fcf185ee7e15fe05cae31fbe9e4ebe4a06a40d",
|
|
78
79
|
"is_secret": false,
|
|
79
80
|
"is_verified": false,
|
|
80
|
-
"line_number":
|
|
81
|
+
"line_number": 122,
|
|
82
|
+
"type": "Secret Keyword",
|
|
83
|
+
"verified_result": null
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"hashed_secret": "24c3d19b8d127fe8f7274108156a718ec56fc6e6",
|
|
87
|
+
"is_secret": false,
|
|
88
|
+
"is_verified": false,
|
|
89
|
+
"line_number": 136,
|
|
90
|
+
"type": "Secret Keyword",
|
|
91
|
+
"verified_result": null
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"hashed_secret": "32e8612d8ca77c7ea8374aa7918db8e5df9252ed",
|
|
95
|
+
"is_secret": false,
|
|
96
|
+
"is_verified": false,
|
|
97
|
+
"line_number": 171,
|
|
81
98
|
"type": "Secret Keyword",
|
|
82
99
|
"verified_result": null
|
|
83
100
|
}
|
|
@@ -97,7 +114,7 @@
|
|
|
97
114
|
"hashed_secret": "32e8612d8ca77c7ea8374aa7918db8e5df9252ed",
|
|
98
115
|
"is_secret": false,
|
|
99
116
|
"is_verified": false,
|
|
100
|
-
"line_number":
|
|
117
|
+
"line_number": 59,
|
|
101
118
|
"type": "Secret Keyword",
|
|
102
119
|
"verified_result": null
|
|
103
120
|
}
|
|
@@ -107,7 +124,7 @@
|
|
|
107
124
|
"hashed_secret": "d5ff02fa48e492fac0a245ad63d1ae608e705c05",
|
|
108
125
|
"is_secret": false,
|
|
109
126
|
"is_verified": false,
|
|
110
|
-
"line_number":
|
|
127
|
+
"line_number": 70,
|
|
111
128
|
"type": "Secret Keyword",
|
|
112
129
|
"verified_result": null
|
|
113
130
|
},
|
|
@@ -115,7 +132,7 @@
|
|
|
115
132
|
"hashed_secret": "8f4bfc22c4fd7cb884f94ec175ff4a3284a174a1",
|
|
116
133
|
"is_secret": false,
|
|
117
134
|
"is_verified": false,
|
|
118
|
-
"line_number":
|
|
135
|
+
"line_number": 71,
|
|
119
136
|
"type": "Secret Keyword",
|
|
120
137
|
"verified_result": null
|
|
121
138
|
}
|
|
@@ -125,15 +142,17 @@
|
|
|
125
142
|
"hashed_secret": "8f4bfc22c4fd7cb884f94ec175ff4a3284a174a1",
|
|
126
143
|
"is_secret": false,
|
|
127
144
|
"is_verified": false,
|
|
128
|
-
"line_number":
|
|
145
|
+
"line_number": 69,
|
|
129
146
|
"type": "Secret Keyword",
|
|
130
147
|
"verified_result": null
|
|
131
|
-
}
|
|
148
|
+
}
|
|
149
|
+
],
|
|
150
|
+
"auth/authenticators/iam-request-based-authenticator.ts": [
|
|
132
151
|
{
|
|
133
152
|
"hashed_secret": "f84f793e0af9ade37c8b927bc5091e98f35bf821",
|
|
134
153
|
"is_secret": false,
|
|
135
154
|
"is_verified": false,
|
|
136
|
-
"line_number":
|
|
155
|
+
"line_number": 78,
|
|
137
156
|
"type": "Secret Keyword",
|
|
138
157
|
"verified_result": null
|
|
139
158
|
},
|
|
@@ -141,7 +160,7 @@
|
|
|
141
160
|
"hashed_secret": "45c43fe97e3a06ab078b0eeff6fbe622cc417a25",
|
|
142
161
|
"is_secret": false,
|
|
143
162
|
"is_verified": false,
|
|
144
|
-
"line_number":
|
|
163
|
+
"line_number": 91,
|
|
145
164
|
"type": "Secret Keyword",
|
|
146
165
|
"verified_result": null
|
|
147
166
|
},
|
|
@@ -149,7 +168,17 @@
|
|
|
149
168
|
"hashed_secret": "99833a8b234b57b886a9aef1dba187fdd7ceece8",
|
|
150
169
|
"is_secret": false,
|
|
151
170
|
"is_verified": false,
|
|
152
|
-
"line_number":
|
|
171
|
+
"line_number": 93,
|
|
172
|
+
"type": "Secret Keyword",
|
|
173
|
+
"verified_result": null
|
|
174
|
+
}
|
|
175
|
+
],
|
|
176
|
+
"auth/token-managers/container-token-manager.ts": [
|
|
177
|
+
{
|
|
178
|
+
"hashed_secret": "184ee1f04a018aa3b897e085516a9b657fea0f6b",
|
|
179
|
+
"is_secret": false,
|
|
180
|
+
"is_verified": false,
|
|
181
|
+
"line_number": 82,
|
|
153
182
|
"type": "Secret Keyword",
|
|
154
183
|
"verified_result": null
|
|
155
184
|
}
|
|
@@ -159,7 +188,7 @@
|
|
|
159
188
|
"hashed_secret": "d5ff02fa48e492fac0a245ad63d1ae608e705c05",
|
|
160
189
|
"is_secret": false,
|
|
161
190
|
"is_verified": false,
|
|
162
|
-
"line_number":
|
|
191
|
+
"line_number": 97,
|
|
163
192
|
"type": "Secret Keyword",
|
|
164
193
|
"verified_result": null
|
|
165
194
|
},
|
|
@@ -167,7 +196,7 @@
|
|
|
167
196
|
"hashed_secret": "8f4bfc22c4fd7cb884f94ec175ff4a3284a174a1",
|
|
168
197
|
"is_secret": false,
|
|
169
198
|
"is_verified": false,
|
|
170
|
-
"line_number":
|
|
199
|
+
"line_number": 98,
|
|
171
200
|
"type": "Secret Keyword",
|
|
172
201
|
"verified_result": null
|
|
173
202
|
},
|
|
@@ -175,7 +204,7 @@
|
|
|
175
204
|
"hashed_secret": "45a15668db917c293f16e8add0f5d801889e5923",
|
|
176
205
|
"is_secret": false,
|
|
177
206
|
"is_verified": false,
|
|
178
|
-
"line_number":
|
|
207
|
+
"line_number": 112,
|
|
179
208
|
"type": "Secret Keyword",
|
|
180
209
|
"verified_result": null
|
|
181
210
|
},
|
|
@@ -183,57 +212,59 @@
|
|
|
183
212
|
"hashed_secret": "65e622227634e8876cfa733000233fb80c6f0473",
|
|
184
213
|
"is_secret": false,
|
|
185
214
|
"is_verified": false,
|
|
186
|
-
"line_number":
|
|
215
|
+
"line_number": 113,
|
|
187
216
|
"type": "Secret Keyword",
|
|
188
217
|
"verified_result": null
|
|
189
218
|
}
|
|
190
219
|
],
|
|
191
|
-
"auth/token-managers/iam-token-manager.ts": [
|
|
220
|
+
"auth/token-managers/iam-request-based-token-manager.ts": [
|
|
192
221
|
{
|
|
193
|
-
"hashed_secret": "
|
|
222
|
+
"hashed_secret": "f84f793e0af9ade37c8b927bc5091e98f35bf821",
|
|
194
223
|
"is_secret": false,
|
|
195
224
|
"is_verified": false,
|
|
196
|
-
"line_number":
|
|
225
|
+
"line_number": 81,
|
|
197
226
|
"type": "Secret Keyword",
|
|
198
227
|
"verified_result": null
|
|
199
228
|
},
|
|
200
229
|
{
|
|
201
|
-
"hashed_secret": "
|
|
230
|
+
"hashed_secret": "45c43fe97e3a06ab078b0eeff6fbe622cc417a25",
|
|
202
231
|
"is_secret": false,
|
|
203
232
|
"is_verified": false,
|
|
204
|
-
"line_number":
|
|
233
|
+
"line_number": 118,
|
|
205
234
|
"type": "Secret Keyword",
|
|
206
235
|
"verified_result": null
|
|
207
236
|
},
|
|
208
237
|
{
|
|
209
|
-
"hashed_secret": "
|
|
238
|
+
"hashed_secret": "99833a8b234b57b886a9aef1dba187fdd7ceece8",
|
|
210
239
|
"is_secret": false,
|
|
211
240
|
"is_verified": false,
|
|
212
|
-
"line_number":
|
|
241
|
+
"line_number": 120,
|
|
213
242
|
"type": "Secret Keyword",
|
|
214
243
|
"verified_result": null
|
|
215
|
-
}
|
|
244
|
+
}
|
|
245
|
+
],
|
|
246
|
+
"auth/token-managers/iam-token-manager.ts": [
|
|
216
247
|
{
|
|
217
|
-
"hashed_secret": "
|
|
248
|
+
"hashed_secret": "8f4bfc22c4fd7cb884f94ec175ff4a3284a174a1",
|
|
218
249
|
"is_secret": false,
|
|
219
250
|
"is_verified": false,
|
|
220
|
-
"line_number":
|
|
251
|
+
"line_number": 60,
|
|
221
252
|
"type": "Secret Keyword",
|
|
222
253
|
"verified_result": null
|
|
223
254
|
},
|
|
224
255
|
{
|
|
225
|
-
"hashed_secret": "
|
|
256
|
+
"hashed_secret": "0358c67856fb6a21c4767daf02fcb8fe4dc0a318",
|
|
226
257
|
"is_secret": false,
|
|
227
258
|
"is_verified": false,
|
|
228
|
-
"line_number":
|
|
259
|
+
"line_number": 63,
|
|
229
260
|
"type": "Secret Keyword",
|
|
230
261
|
"verified_result": null
|
|
231
262
|
},
|
|
232
263
|
{
|
|
233
|
-
"hashed_secret": "
|
|
264
|
+
"hashed_secret": "dbb19b8ae3b78f908e1467721fe4c9f0b0529d9b",
|
|
234
265
|
"is_secret": false,
|
|
235
266
|
"is_verified": false,
|
|
236
|
-
"line_number":
|
|
267
|
+
"line_number": 64,
|
|
237
268
|
"type": "Secret Keyword",
|
|
238
269
|
"verified_result": null
|
|
239
270
|
}
|
|
@@ -243,7 +274,7 @@
|
|
|
243
274
|
"hashed_secret": "6947818ac409551f11fbaa78f0ea6391960aa5b8",
|
|
244
275
|
"is_secret": false,
|
|
245
276
|
"is_verified": false,
|
|
246
|
-
"line_number":
|
|
277
|
+
"line_number": 48,
|
|
247
278
|
"type": "Secret Keyword",
|
|
248
279
|
"verified_result": null
|
|
249
280
|
}
|
|
@@ -325,7 +356,17 @@
|
|
|
325
356
|
"hashed_secret": "09f798553f7c035c2915bf8c59b46b6c285d2d84",
|
|
326
357
|
"is_secret": false,
|
|
327
358
|
"is_verified": false,
|
|
328
|
-
"line_number":
|
|
359
|
+
"line_number": 4,
|
|
360
|
+
"type": "Secret Keyword",
|
|
361
|
+
"verified_result": null
|
|
362
|
+
}
|
|
363
|
+
],
|
|
364
|
+
"test/unit/container-authenticator.test.js": [
|
|
365
|
+
{
|
|
366
|
+
"hashed_secret": "5c5a15a8b0b3e154d77746945e563ba40100681b",
|
|
367
|
+
"is_secret": false,
|
|
368
|
+
"is_verified": false,
|
|
369
|
+
"line_number": 19,
|
|
329
370
|
"type": "Secret Keyword",
|
|
330
371
|
"verified_result": null
|
|
331
372
|
}
|
|
@@ -335,7 +376,7 @@
|
|
|
335
376
|
"hashed_secret": "85dd3fb12cb0dcae03f1bba6fb61f4edd90d986d",
|
|
336
377
|
"is_secret": false,
|
|
337
378
|
"is_verified": false,
|
|
338
|
-
"line_number":
|
|
379
|
+
"line_number": 5,
|
|
339
380
|
"type": "Secret Keyword",
|
|
340
381
|
"verified_result": null
|
|
341
382
|
},
|
|
@@ -343,7 +384,7 @@
|
|
|
343
384
|
"hashed_secret": "0c910ad3070d996b37a1c65f542b17adc3f962bc",
|
|
344
385
|
"is_secret": false,
|
|
345
386
|
"is_verified": false,
|
|
346
|
-
"line_number":
|
|
387
|
+
"line_number": 6,
|
|
347
388
|
"type": "Secret Keyword",
|
|
348
389
|
"verified_result": null
|
|
349
390
|
}
|
|
@@ -353,7 +394,7 @@
|
|
|
353
394
|
"hashed_secret": "1572bd30ac06678a82df42b5913e5e52e27f9a12",
|
|
354
395
|
"is_secret": false,
|
|
355
396
|
"is_verified": false,
|
|
356
|
-
"line_number":
|
|
397
|
+
"line_number": 15,
|
|
357
398
|
"type": "Secret Keyword",
|
|
358
399
|
"verified_result": null
|
|
359
400
|
},
|
|
@@ -361,7 +402,7 @@
|
|
|
361
402
|
"hashed_secret": "16856d955c788df03735a24feb2e3ffefd91f3dc",
|
|
362
403
|
"is_secret": false,
|
|
363
404
|
"is_verified": false,
|
|
364
|
-
"line_number":
|
|
405
|
+
"line_number": 16,
|
|
365
406
|
"type": "Secret Keyword",
|
|
366
407
|
"verified_result": null
|
|
367
408
|
}
|
|
@@ -371,7 +412,7 @@
|
|
|
371
412
|
"hashed_secret": "257368587362aab7f1180b4a5fe550ec26053e05",
|
|
372
413
|
"is_secret": false,
|
|
373
414
|
"is_verified": false,
|
|
374
|
-
"line_number":
|
|
415
|
+
"line_number": 14,
|
|
375
416
|
"type": "Secret Keyword",
|
|
376
417
|
"verified_result": null
|
|
377
418
|
},
|
|
@@ -379,7 +420,7 @@
|
|
|
379
420
|
"hashed_secret": "5c5a15a8b0b3e154d77746945e563ba40100681b",
|
|
380
421
|
"is_secret": false,
|
|
381
422
|
"is_verified": false,
|
|
382
|
-
"line_number":
|
|
423
|
+
"line_number": 17,
|
|
383
424
|
"type": "Secret Keyword",
|
|
384
425
|
"verified_result": null
|
|
385
426
|
},
|
|
@@ -387,7 +428,7 @@
|
|
|
387
428
|
"hashed_secret": "a3bf8418470bbb21ecdb24c28e38b446a3ab9b75",
|
|
388
429
|
"is_secret": false,
|
|
389
430
|
"is_verified": false,
|
|
390
|
-
"line_number":
|
|
431
|
+
"line_number": 48,
|
|
391
432
|
"type": "Secret Keyword",
|
|
392
433
|
"verified_result": null
|
|
393
434
|
},
|
|
@@ -395,7 +436,7 @@
|
|
|
395
436
|
"hashed_secret": "2c208e466e476d4d8cbe055832f40f04e4d5dd23",
|
|
396
437
|
"is_secret": false,
|
|
397
438
|
"is_verified": false,
|
|
398
|
-
"line_number":
|
|
439
|
+
"line_number": 53,
|
|
399
440
|
"type": "Secret Keyword",
|
|
400
441
|
"verified_result": null
|
|
401
442
|
},
|
|
@@ -403,25 +444,37 @@
|
|
|
403
444
|
"hashed_secret": "945db841c03e42eef2f3d0a4ff310e2f3b3e59ec",
|
|
404
445
|
"is_secret": false,
|
|
405
446
|
"is_verified": false,
|
|
406
|
-
"line_number":
|
|
447
|
+
"line_number": 77,
|
|
407
448
|
"type": "Secret Keyword",
|
|
408
449
|
"verified_result": null
|
|
409
450
|
}
|
|
410
451
|
],
|
|
411
|
-
"test/unit/iam-
|
|
452
|
+
"test/unit/iam-request-based-authenticator.test.js": [
|
|
412
453
|
{
|
|
413
|
-
"hashed_secret": "
|
|
454
|
+
"hashed_secret": "43ed4c2d8375dfc89e3dc8c917f404b9481d355b",
|
|
414
455
|
"is_secret": false,
|
|
415
456
|
"is_verified": false,
|
|
416
|
-
"line_number":
|
|
457
|
+
"line_number": 5,
|
|
417
458
|
"type": "Secret Keyword",
|
|
418
459
|
"verified_result": null
|
|
419
|
-
}
|
|
460
|
+
}
|
|
461
|
+
],
|
|
462
|
+
"test/unit/iam-request-based-token-manager.test.js": [
|
|
463
|
+
{
|
|
464
|
+
"hashed_secret": "43ed4c2d8375dfc89e3dc8c917f404b9481d355b",
|
|
465
|
+
"is_secret": false,
|
|
466
|
+
"is_verified": false,
|
|
467
|
+
"line_number": 13,
|
|
468
|
+
"type": "Secret Keyword",
|
|
469
|
+
"verified_result": null
|
|
470
|
+
}
|
|
471
|
+
],
|
|
472
|
+
"test/unit/iam-token-manager.test.js": [
|
|
420
473
|
{
|
|
421
474
|
"hashed_secret": "a7ef1be18bb8d37af79f3d87761a203378bf26a2",
|
|
422
475
|
"is_secret": false,
|
|
423
476
|
"is_verified": false,
|
|
424
|
-
"line_number":
|
|
477
|
+
"line_number": 129,
|
|
425
478
|
"type": "Secret Keyword",
|
|
426
479
|
"verified_result": null
|
|
427
480
|
}
|
|
@@ -431,7 +484,7 @@
|
|
|
431
484
|
"hashed_secret": "4c65cd3f160d60f7ca28ca04fa60b9035132781c",
|
|
432
485
|
"is_secret": false,
|
|
433
486
|
"is_verified": false,
|
|
434
|
-
"line_number":
|
|
487
|
+
"line_number": 7,
|
|
435
488
|
"type": "Secret Keyword",
|
|
436
489
|
"verified_result": null
|
|
437
490
|
},
|
|
@@ -439,7 +492,7 @@
|
|
|
439
492
|
"hashed_secret": "407bb564bd0e4d31368cb53004c9c42adf8f7be8",
|
|
440
493
|
"is_secret": false,
|
|
441
494
|
"is_verified": false,
|
|
442
|
-
"line_number":
|
|
495
|
+
"line_number": 163,
|
|
443
496
|
"type": "Secret Keyword",
|
|
444
497
|
"verified_result": null
|
|
445
498
|
},
|
|
@@ -447,7 +500,7 @@
|
|
|
447
500
|
"hashed_secret": "2863fa4b5510c46afc2bd2998dfbc0cf3d6df032",
|
|
448
501
|
"is_secret": false,
|
|
449
502
|
"is_verified": false,
|
|
450
|
-
"line_number":
|
|
503
|
+
"line_number": 189,
|
|
451
504
|
"type": "Secret Keyword",
|
|
452
505
|
"verified_result": null
|
|
453
506
|
},
|
|
@@ -455,13 +508,13 @@
|
|
|
455
508
|
"hashed_secret": "ed8c99e906cf3fdbae90a71e06142ebc72b4c056",
|
|
456
509
|
"is_secret": false,
|
|
457
510
|
"is_verified": false,
|
|
458
|
-
"line_number":
|
|
511
|
+
"line_number": 207,
|
|
459
512
|
"type": "Secret Keyword",
|
|
460
513
|
"verified_result": null
|
|
461
514
|
}
|
|
462
515
|
]
|
|
463
516
|
},
|
|
464
|
-
"version": "0.13.1+ibm.
|
|
517
|
+
"version": "0.13.1+ibm.40.dss",
|
|
465
518
|
"word_list": {
|
|
466
519
|
"file": null,
|
|
467
520
|
"hash": null
|
package/Authentication.md
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
# Authentication
|
|
2
2
|
The node-sdk-core project supports the following types of authentication:
|
|
3
3
|
- Basic Authentication
|
|
4
|
-
- Bearer Token
|
|
4
|
+
- Bearer Token
|
|
5
5
|
- Identity and Access Management (IAM)
|
|
6
6
|
- Cloud Pak for Data
|
|
7
|
+
- Container
|
|
7
8
|
- No Authentication
|
|
8
9
|
|
|
9
10
|
The SDK user configures the appropriate type of authentication for use with service instances.
|
|
@@ -131,12 +132,13 @@ The `CloudPakForDataAuthenticator` will accept user-supplied username and passwo
|
|
|
131
132
|
|
|
132
133
|
### Properties
|
|
133
134
|
- username: (required) the username used to obtain a bearer token.
|
|
134
|
-
- password: (required) the password used to obtain a bearer token.
|
|
135
|
+
- password: (password or apikey required) the password used to obtain a bearer token.
|
|
136
|
+
- apikey: (password or apikey required) the API key used to obtain a bearer token.
|
|
135
137
|
- url: (required) The URL representing the Cloud Pak for Data token service endpoint.
|
|
136
138
|
- disableSslVerification: (optional) A flag that indicates whether verificaton of the server's SSL certificate should be disabled or not. The default value is `false`.
|
|
137
139
|
- headers: (optional) A set of key/value pairs that will be sent as HTTP headers in requests made to the IAM token service.
|
|
138
140
|
|
|
139
|
-
### Programming
|
|
141
|
+
### Programming examples
|
|
140
142
|
```js
|
|
141
143
|
import { CloudPakForDataAuthenticator } from 'ibm-cloud-sdk-core';
|
|
142
144
|
|
|
@@ -147,6 +149,16 @@ const authenticator = new CloudPakForDataAuthenticator({
|
|
|
147
149
|
});
|
|
148
150
|
```
|
|
149
151
|
|
|
152
|
+
```js
|
|
153
|
+
import { CloudPakForDataAuthenticator } from 'ibm-cloud-sdk-core';
|
|
154
|
+
|
|
155
|
+
const authenticator = new CloudPakForDataAuthenticator({
|
|
156
|
+
username: '{username}',
|
|
157
|
+
apikey: '{apikey}',
|
|
158
|
+
url: '{url}',
|
|
159
|
+
});
|
|
160
|
+
```
|
|
161
|
+
|
|
150
162
|
### External configuration example
|
|
151
163
|
```js
|
|
152
164
|
import { getAuthenticatorFromEnvironment } from 'ibm-cloud-sdk-core';
|
|
@@ -156,9 +168,60 @@ import { getAuthenticatorFromEnvironment } from 'ibm-cloud-sdk-core';
|
|
|
156
168
|
// MY_SERVICE_AUTH_URL=<url>
|
|
157
169
|
// MY_SERVICE_USERNAME=<username>
|
|
158
170
|
// MY_SERVICE_PASSWORD=<password>
|
|
171
|
+
// MY_SERVICE_APIKEY=<apikey>
|
|
159
172
|
const cp4dAuthenticator = getAuthenticatorFromEnvironment('my-service');
|
|
160
173
|
```
|
|
161
174
|
|
|
175
|
+
## Container
|
|
176
|
+
The `ContainerAuthenticator` is intended to be used by application code
|
|
177
|
+
running inside a compute resource managed by the IBM Kubernetes Service (IKS)
|
|
178
|
+
in which a secure compute resource token (CR token) has been stored in a file
|
|
179
|
+
within the compute resource's local file system.
|
|
180
|
+
The CR token is similar to an IAM apikey except that it is managed automatically by
|
|
181
|
+
the compute resource provider (IKS).
|
|
182
|
+
This allows the application developer to:
|
|
183
|
+
- avoid storing credentials in application code, configuraton files or a password vault
|
|
184
|
+
- avoid managing or rotating credentials
|
|
185
|
+
|
|
186
|
+
The `ContainerAuthenticator` will retrieve the CR token from
|
|
187
|
+
the compute resource in which the application is running, and will then perform
|
|
188
|
+
the necessary interactions with the IAM token service to obtain an IAM access token
|
|
189
|
+
using the IAM "get token" operation with grant-type `cr-token`.
|
|
190
|
+
The authenticator will repeat these steps to obtain a new IAM access token when the
|
|
191
|
+
current access token expires.
|
|
192
|
+
The IAM access token is added to each outbound request in the `Authorization` header in the form:
|
|
193
|
+
```
|
|
194
|
+
Authorization: Bearer <IAM-access-token>
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Properties
|
|
198
|
+
- crTokenFilename: (optional) The name of the file containing the injected CR token value. If not specified, then `/var/run/secrets/tokens/vault-token` is used as the default value. The application must have `read` permissions on the file containing the CR token value.
|
|
199
|
+
- iamProfileName: (optional) The name of the linked trusted IAM profile to be used when obtaining the IAM access token (a CR token might map to multiple IAM profiles). One of `iamProfileName` or `iamProfileId` must be specified.
|
|
200
|
+
- iamProfileId: (optional) The ID of the linked trusted IAM profile to be used when obtaining the IAM access token (a CR token might map to multiple IAM profiles). One of `iamProfileName` or `iamProfileId` must be specified.
|
|
201
|
+
- url: (optional) The URL representing the IAM token service endpoint. If not specified, a suitable default value is used.
|
|
202
|
+
- clientId/clientSecret: (optional) The `clientId` and `clientSecret` fields are used to form a "basic auth" Authorization header for interactions with the IAM token server. If neither field is specified, then no Authorization header will be sent with token server requests. These fields are optional, but must be specified together.
|
|
203
|
+
- disableSslVerification: (optional) A flag that indicates whether verificaton of the server's SSL certificate should be disabled or not. The default value is `false`.
|
|
204
|
+
- headers: (optional) A set of key/value pairs that will be sent as HTTP headers in requests made to the IAM token service.
|
|
205
|
+
|
|
206
|
+
### Programming example
|
|
207
|
+
```js
|
|
208
|
+
import { ContainerAuthenticator } from 'ibm-cloud-sdk-core';
|
|
209
|
+
|
|
210
|
+
const authenticator = new ContainerAuthenticator({
|
|
211
|
+
iamProfileName: '{profile-name}',
|
|
212
|
+
});
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### External configuration example
|
|
216
|
+
```js
|
|
217
|
+
import { getAuthenticatorFromEnvironment } from 'ibm-cloud-sdk-core';
|
|
218
|
+
|
|
219
|
+
// env vars
|
|
220
|
+
// MY_SERVICE_AUTH_TYPE=container
|
|
221
|
+
// MY_SERVICE_IAM_PROFILE_ID=my_profile_name
|
|
222
|
+
const containerAuthenticator = getAuthenticatorFromEnvironment('my-service');
|
|
223
|
+
```
|
|
224
|
+
|
|
162
225
|
## No Auth Authentication
|
|
163
226
|
The `NoAuthAuthenticator` is a placeholder authenticator which performs no actual authentication function. It can be used in situations where authentication needs to be bypassed, perhaps while developing or debugging an application or service.
|
|
164
227
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
## [2.12.2](https://github.com/IBM/node-sdk-core/compare/v2.12.1...v2.12.2) (2021-08-13)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* support 'AUTHTYPE' as alias for 'AUTH_TYPE' config property ([#153](https://github.com/IBM/node-sdk-core/issues/153)) ([fccf209](https://github.com/IBM/node-sdk-core/commit/fccf2093874835d9c77c08843809b79e57fb0e78))
|
|
7
|
+
|
|
8
|
+
## [2.12.1](https://github.com/IBM/node-sdk-core/compare/v2.12.0...v2.12.1) (2021-08-11)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* use typescript 3.8.x to build the published code ([#152](https://github.com/IBM/node-sdk-core/issues/152)) ([4362a37](https://github.com/IBM/node-sdk-core/commit/4362a376b3419baa5e7e428b03490bf021d0a295))
|
|
14
|
+
|
|
15
|
+
# [2.12.0](https://github.com/IBM/node-sdk-core/compare/v2.11.3...v2.12.0) (2021-08-10)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* add support for new ContainerAuthenticator ([#151](https://github.com/IBM/node-sdk-core/issues/151)) ([b01c011](https://github.com/IBM/node-sdk-core/commit/b01c011021671ebeb3c49de84fb17315eae3629f))
|
|
21
|
+
|
|
22
|
+
## [2.11.3](https://github.com/IBM/node-sdk-core/compare/v2.11.2...v2.11.3) (2021-06-14)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* **build:** revert inadvertently-committed directories ([#147](https://github.com/IBM/node-sdk-core/issues/147)) ([1fb6295](https://github.com/IBM/node-sdk-core/commit/1fb62955e74e73c805b6221ca85e22517335f273))
|
|
28
|
+
|
|
1
29
|
## [2.11.2](https://github.com/IBM/node-sdk-core/compare/v2.11.1...v2.11.2) (2021-06-10)
|
|
2
30
|
|
|
3
31
|
|
package/README.md
CHANGED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2021 IBM Corp. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { ContainerTokenManager } from '../token-managers';
|
|
17
|
+
import { IamRequestOptions, IamRequestBasedAuthenticator } from './iam-request-based-authenticator';
|
|
18
|
+
/** Configuration options for IAM authentication. */
|
|
19
|
+
export interface Options extends IamRequestOptions {
|
|
20
|
+
/** The file containing the compute resource token. */
|
|
21
|
+
crTokenFilename?: string;
|
|
22
|
+
/** The IAM profile name associated with the compute resource token. */
|
|
23
|
+
iamProfileName?: string;
|
|
24
|
+
/** The IAM profile ID associated with the compute resource token. */
|
|
25
|
+
iamProfileId?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The [[ContainerAuthenticator]] will read a compute resource token from the file system
|
|
29
|
+
* and use this value to obtain a bearer token from the IAM token server. When the bearer
|
|
30
|
+
* token expires, a new token is obtained from the token server.
|
|
31
|
+
*
|
|
32
|
+
* The bearer token will be sent as an Authorization header in the form:
|
|
33
|
+
*
|
|
34
|
+
* Authorization: Bearer <bearer-token>
|
|
35
|
+
*/
|
|
36
|
+
export declare class ContainerAuthenticator extends IamRequestBasedAuthenticator {
|
|
37
|
+
protected tokenManager: ContainerTokenManager;
|
|
38
|
+
private crTokenFilename;
|
|
39
|
+
private iamProfileName;
|
|
40
|
+
private iamProfileId;
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
* Create a new [[ContainerAuthenticator]] instance.
|
|
44
|
+
*
|
|
45
|
+
* @param {object} options Configuration options for IAM authentication.
|
|
46
|
+
* @param {string} [options.crTokenFilename] The file containing the compute resource token.
|
|
47
|
+
* @param {string} [options.iamProfileName] The IAM profile name associated with the compute resource token.
|
|
48
|
+
* @param {string} [options.iamProfileId] The IAM profile ID associated with the compute resource token.
|
|
49
|
+
* @param {boolean} [options.disableSslVerification] A flag that indicates
|
|
50
|
+
* whether verification of the token server's SSL certificate should be
|
|
51
|
+
* disabled or not
|
|
52
|
+
* @param {string} [options.url] for HTTP token requests.
|
|
53
|
+
* @param {object<string, string>} options.headers to be sent with every
|
|
54
|
+
* @param {string} [options.clientId] The `clientId` and `clientSecret` fields are used to form a "basic"
|
|
55
|
+
* authorization header for IAM token requests.
|
|
56
|
+
* @param {string} [options.clientSecret] The `clientId` and `clientSecret` fields are used to form a "basic"
|
|
57
|
+
* authorization header for IAM token requests.
|
|
58
|
+
* @param {string} [options.scope] The "scope" parameter to use when fetching the bearer token from the
|
|
59
|
+
* IAM token server.
|
|
60
|
+
* @throws {Error} When the configuration options are not valid.
|
|
61
|
+
*/
|
|
62
|
+
constructor(options: Options);
|
|
63
|
+
/**
|
|
64
|
+
* Setter for the filename of the compute resource token.
|
|
65
|
+
* @param {string} scope A string containing a path to the CR token file
|
|
66
|
+
*/
|
|
67
|
+
setCrTokenFilename(crTokenFilename: string): void;
|
|
68
|
+
/**
|
|
69
|
+
* Setter for the "profile_name" parameter to use when fetching the bearer token from the IAM token server.
|
|
70
|
+
* @param {string} scope A string that makes up the iamProfileName parameter
|
|
71
|
+
*/
|
|
72
|
+
setIamProfileName(iamProfileName: string): void;
|
|
73
|
+
/**
|
|
74
|
+
* Setter for the "profile_id" parameter to use when fetching the bearer token from the IAM token server.
|
|
75
|
+
* @param {string} scope A string that makes up the iamProfileId parameter
|
|
76
|
+
*/
|
|
77
|
+
setIamProfileId(iamProfileId: string): void;
|
|
78
|
+
}
|