ibm-cloud-sdk-core 4.0.0 → 4.0.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 +20 -30
- package/CHANGELOG.md +16 -4
- package/MIGRATION-V4.md +54 -0
- package/auth/authenticators/authenticator-interface.d.ts +3 -4
- package/auth/authenticators/authenticator-interface.js +1 -1
- package/auth/authenticators/authenticator.d.ts +5 -9
- package/auth/authenticators/authenticator.js +4 -8
- package/auth/authenticators/basic-authenticator.d.ts +12 -12
- package/auth/authenticators/basic-authenticator.js +12 -12
- package/auth/authenticators/bearer-token-authenticator.d.ts +11 -14
- package/auth/authenticators/bearer-token-authenticator.js +11 -14
- package/auth/authenticators/cloud-pak-for-data-authenticator.d.ts +15 -15
- package/auth/authenticators/cloud-pak-for-data-authenticator.js +15 -15
- package/auth/authenticators/container-authenticator.d.ts +23 -23
- package/auth/authenticators/container-authenticator.js +23 -23
- package/auth/authenticators/iam-authenticator.d.ts +20 -20
- package/auth/authenticators/iam-authenticator.js +20 -20
- package/auth/authenticators/iam-request-based-authenticator.d.ts +23 -25
- package/auth/authenticators/iam-request-based-authenticator.js +23 -25
- package/auth/authenticators/token-request-based-authenticator.d.ts +19 -24
- package/auth/authenticators/token-request-based-authenticator.js +19 -24
- package/auth/authenticators/vpc-instance-authenticator.d.ts +17 -16
- package/auth/authenticators/vpc-instance-authenticator.js +17 -16
- package/auth/token-managers/container-token-manager.d.ts +23 -25
- package/auth/token-managers/container-token-manager.js +23 -25
- package/auth/token-managers/cp4d-token-manager.d.ts +13 -13
- package/auth/token-managers/cp4d-token-manager.js +13 -13
- package/auth/token-managers/iam-request-based-token-manager.d.ts +26 -31
- package/auth/token-managers/iam-request-based-token-manager.js +26 -31
- package/auth/token-managers/iam-token-manager.d.ts +17 -16
- package/auth/token-managers/iam-token-manager.js +17 -16
- package/auth/token-managers/jwt-token-manager.d.ts +10 -13
- package/auth/token-managers/jwt-token-manager.js +13 -16
- package/auth/token-managers/token-manager.d.ts +23 -35
- package/auth/token-managers/token-manager.js +22 -34
- package/auth/token-managers/vpc-instance-token-manager.d.ts +15 -15
- package/auth/token-managers/vpc-instance-token-manager.js +15 -15
- package/auth/utils/get-authenticator-from-environment.d.ts +2 -2
- package/auth/utils/get-authenticator-from-environment.js +2 -2
- package/auth/utils/helpers.d.ts +34 -32
- package/auth/utils/helpers.js +34 -32
- package/auth/utils/read-external-sources.d.ts +2 -1
- package/auth/utils/read-external-sources.js +5 -4
- package/build/docs/ibm-cloud-sdk-core.atleastone.md +4 -4
- package/build/docs/ibm-cloud-sdk-core.atmostone.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.authenticator._constructor_.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.authenticator.authenticate.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.authenticator.authenticationtype.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.authenticator.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.authenticatorinterface.authenticate.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.baseservice._constructor_.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.baseservice.configureservice.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.baseservice.createrequest.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.baseservice.enableretries.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.baseservice.getauthenticator.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.baseservice.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.baseservice.setdefaultheaders.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.baseservice.setserviceurl.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.basicauthenticator._constructor_.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.basicauthenticator.authenticate.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.basicauthenticator.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.bearertokenauthenticator._constructor_.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.bearertokenauthenticator.authenticate.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.bearertokenauthenticator.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.buildrequestfileobject.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.checkcredentials.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.cloudpakfordataauthenticator._constructor_.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.cloudpakfordataauthenticator.md +5 -5
- package/build/docs/ibm-cloud-sdk-core.computebasicauthheader.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.constructserviceurl.md +4 -4
- package/build/docs/ibm-cloud-sdk-core.containerauthenticator._constructor_.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.containerauthenticator.md +4 -4
- package/build/docs/ibm-cloud-sdk-core.containerauthenticator.setcrtokenfilename.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.containerauthenticator.setiamprofileid.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.containerauthenticator.setiamprofilename.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.containertokenmanager._constructor_.md +6 -2
- package/build/docs/ibm-cloud-sdk-core.containertokenmanager.md +5 -5
- package/build/docs/ibm-cloud-sdk-core.containertokenmanager.requesttoken.md +0 -2
- package/build/docs/ibm-cloud-sdk-core.containertokenmanager.setcrtokenfilename.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.containertokenmanager.setiamprofileid.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.containertokenmanager.setiamprofilename.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.cp4dtokenmanager._constructor_.md +6 -2
- package/build/docs/ibm-cloud-sdk-core.cp4dtokenmanager.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.fileobject.md +5 -5
- package/build/docs/ibm-cloud-sdk-core.fileoptions.md +4 -4
- package/build/docs/ibm-cloud-sdk-core.filestream.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.filewithmetadata.md +5 -5
- package/build/docs/ibm-cloud-sdk-core.getauthenticatorfromenvironment.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.getcontenttype.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.getcurrenttime.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.getformat.md +0 -2
- package/build/docs/ibm-cloud-sdk-core.getmissingparams.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.getnewlogger.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.getqueryparam.md +1 -5
- package/build/docs/ibm-cloud-sdk-core.iamauthenticator._constructor_.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.iamauthenticator.md +5 -5
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator._constructor_.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.getrefreshtoken.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.md +7 -7
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.setclientidandsecret.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.setscope.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager._constructor_.md +6 -2
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.getrefreshtoken.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.md +8 -8
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.requesttoken.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.savetokeninfo.md +1 -3
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.setclientidandsecret.md +3 -5
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.setscope.md +2 -4
- package/build/docs/ibm-cloud-sdk-core.iamrequestoptions.md +5 -5
- package/build/docs/ibm-cloud-sdk-core.iamtokenmanager._constructor_.md +6 -2
- package/build/docs/ibm-cloud-sdk-core.iamtokenmanager.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.ishtml.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.jwttokenmanager._constructor_.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.jwttokenmanager.md +5 -5
- package/build/docs/ibm-cloud-sdk-core.jwttokenmanager.requesttoken.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.jwttokenmanager.savetokeninfo.md +1 -3
- package/build/docs/ibm-cloud-sdk-core.md +24 -24
- package/build/docs/ibm-cloud-sdk-core.onlyone.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.qs.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.readexternalsources.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.removesuffix.md +4 -4
- package/build/docs/ibm-cloud-sdk-core.sdklogger.md +7 -7
- package/build/docs/ibm-cloud-sdk-core.streamtopromise.md +3 -1
- package/build/docs/ibm-cloud-sdk-core.striptrailingslash.md +4 -2
- package/build/docs/ibm-cloud-sdk-core.tokenmanager._constructor_.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.gettoken.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.md +15 -15
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.pacedrequesttoken.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.requesttoken.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.savetokeninfo.md +1 -3
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.setdisablesslverification.md +1 -3
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.setheaders.md +2 -4
- package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator._constructor_.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.authenticate.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.md +9 -9
- package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.setdisablesslverification.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.setheaders.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.tolowerkeys.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.unittestutils.checkforsuccessfulexecution.md +0 -2
- package/build/docs/ibm-cloud-sdk-core.unittestutils.checkmediaheaders.md +0 -2
- package/build/docs/ibm-cloud-sdk-core.unittestutils.checkurlandmethod.md +1 -3
- package/build/docs/ibm-cloud-sdk-core.unittestutils.checkuserheader.md +0 -2
- package/build/docs/ibm-cloud-sdk-core.unittestutils.expecttobepromise.md +0 -2
- package/build/docs/ibm-cloud-sdk-core.unittestutils.getoptions.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.useroptions.md +9 -9
- package/build/docs/ibm-cloud-sdk-core.validateinput.md +8 -2
- package/build/docs/ibm-cloud-sdk-core.validateparams.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.vpcinstanceauthenticator._constructor_.md +6 -2
- package/build/docs/ibm-cloud-sdk-core.vpcinstanceauthenticator.md +6 -6
- package/build/docs/ibm-cloud-sdk-core.vpcinstanceauthenticator.setiamprofilecrn.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.vpcinstanceauthenticator.setiamprofileid.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.vpcinstancetokenmanager._constructor_.md +6 -2
- package/build/docs/ibm-cloud-sdk-core.vpcinstancetokenmanager.md +4 -4
- package/build/docs/ibm-cloud-sdk-core.vpcinstancetokenmanager.setiamprofilecrn.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.vpcinstancetokenmanager.setiamprofileid.md +2 -2
- package/docs/ibm-cloud-sdk-core.api.json +516 -241
- package/es/auth/authenticators/authenticator-interface.d.ts +3 -4
- package/es/auth/authenticators/authenticator-interface.js +1 -1
- package/es/auth/authenticators/authenticator.d.ts +5 -9
- package/es/auth/authenticators/authenticator.js +4 -8
- package/es/auth/authenticators/basic-authenticator.d.ts +12 -12
- package/es/auth/authenticators/basic-authenticator.js +12 -12
- package/es/auth/authenticators/bearer-token-authenticator.d.ts +11 -14
- package/es/auth/authenticators/bearer-token-authenticator.js +11 -14
- package/es/auth/authenticators/cloud-pak-for-data-authenticator.d.ts +15 -15
- package/es/auth/authenticators/cloud-pak-for-data-authenticator.js +15 -15
- package/es/auth/authenticators/container-authenticator.d.ts +23 -23
- package/es/auth/authenticators/container-authenticator.js +23 -23
- package/es/auth/authenticators/iam-authenticator.d.ts +20 -20
- package/es/auth/authenticators/iam-authenticator.js +20 -20
- package/es/auth/authenticators/iam-request-based-authenticator.d.ts +23 -25
- package/es/auth/authenticators/iam-request-based-authenticator.js +23 -25
- package/es/auth/authenticators/token-request-based-authenticator.d.ts +19 -24
- package/es/auth/authenticators/token-request-based-authenticator.js +19 -24
- package/es/auth/authenticators/vpc-instance-authenticator.d.ts +17 -16
- package/es/auth/authenticators/vpc-instance-authenticator.js +17 -16
- package/es/auth/token-managers/container-token-manager.d.ts +23 -25
- package/es/auth/token-managers/container-token-manager.js +23 -25
- package/es/auth/token-managers/cp4d-token-manager.d.ts +13 -13
- package/es/auth/token-managers/cp4d-token-manager.js +13 -13
- package/es/auth/token-managers/iam-request-based-token-manager.d.ts +26 -31
- package/es/auth/token-managers/iam-request-based-token-manager.js +26 -31
- package/es/auth/token-managers/iam-token-manager.d.ts +17 -16
- package/es/auth/token-managers/iam-token-manager.js +17 -16
- package/es/auth/token-managers/jwt-token-manager.d.ts +10 -13
- package/es/auth/token-managers/jwt-token-manager.js +13 -16
- package/es/auth/token-managers/token-manager.d.ts +23 -35
- package/es/auth/token-managers/token-manager.js +22 -34
- package/es/auth/token-managers/vpc-instance-token-manager.d.ts +15 -15
- package/es/auth/token-managers/vpc-instance-token-manager.js +15 -15
- package/es/auth/utils/get-authenticator-from-environment.d.ts +2 -2
- package/es/auth/utils/get-authenticator-from-environment.js +2 -2
- package/es/auth/utils/helpers.d.ts +34 -32
- package/es/auth/utils/helpers.js +34 -32
- package/es/auth/utils/read-external-sources.d.ts +2 -1
- package/es/auth/utils/read-external-sources.js +5 -4
- package/es/lib/base-service.d.ts +31 -32
- package/es/lib/base-service.js +31 -32
- package/es/lib/content-type.js +5 -5
- package/es/lib/get-new-logger.d.ts +2 -2
- package/es/lib/get-new-logger.js +2 -2
- package/es/lib/helper.d.ts +24 -31
- package/es/lib/helper.js +25 -32
- package/es/lib/querystring.d.ts +1 -1
- package/es/lib/querystring.js +3 -3
- package/es/lib/request-wrapper.d.ts +4 -6
- package/es/lib/request-wrapper.js +17 -23
- package/es/lib/sdk-test-helpers.d.ts +14 -19
- package/es/lib/sdk-test-helpers.js +14 -19
- package/es/lib/stream-to-promise.d.ts +3 -3
- package/es/lib/stream-to-promise.js +3 -3
- package/es/tsdoc-metadata.json +1 -1
- package/etc/ibm-cloud-sdk-core.api.md +12 -12
- package/ibm-cloud-sdk-core.d.ts +1402 -1449
- package/lib/base-service.d.ts +31 -32
- package/lib/base-service.js +31 -32
- package/lib/content-type.js +5 -5
- package/lib/get-new-logger.d.ts +2 -2
- package/lib/get-new-logger.js +2 -2
- package/lib/helper.d.ts +24 -31
- package/lib/helper.js +25 -32
- package/lib/querystring.d.ts +1 -1
- package/lib/querystring.js +3 -3
- package/lib/request-wrapper.d.ts +4 -6
- package/lib/request-wrapper.js +17 -23
- package/lib/sdk-test-helpers.d.ts +14 -19
- package/lib/sdk-test-helpers.js +14 -19
- package/lib/stream-to-promise.d.ts +3 -3
- package/lib/stream-to-promise.js +3 -3
- package/package.json +2 -2
- package/temp/ibm-cloud-sdk-core.api.json +516 -241
- package/temp/ibm-cloud-sdk-core.api.md +12 -12
- package/MIGRATION-V1.md +0 -42
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* (C) Copyright IBM Corp. 2019,
|
|
3
|
+
* (C) Copyright IBM Corp. 2019, 2022.
|
|
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.
|
|
@@ -52,20 +52,21 @@ var IamRequestBasedTokenManager = /** @class */ (function (_super) {
|
|
|
52
52
|
__extends(IamRequestBasedTokenManager, _super);
|
|
53
53
|
/**
|
|
54
54
|
*
|
|
55
|
-
* Create a new
|
|
55
|
+
* Create a new IamRequestBasedTokenManager instance.
|
|
56
56
|
*
|
|
57
|
-
* @param
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
57
|
+
* @param options - Configuration options.
|
|
58
|
+
* This should be an object containing these fields:
|
|
59
|
+
* - url: (optional) the endpoint URL for the token service (default value: "https://iam.cloud.ibm.com")
|
|
60
|
+
* - disableSslVerification: (optional) a flag that indicates whether verification of the token server's SSL certificate
|
|
61
|
+
* should be disabled or not
|
|
62
|
+
* - headers: (optional) a set of HTTP headers to be sent with each request to the token service
|
|
63
|
+
* - clientId: (optional) the "clientId" and "clientSecret" fields are used to form a Basic
|
|
64
|
+
* Authorization header to be included in each request to the token service
|
|
65
|
+
* - clientSecret: (optional) the "clientId" and "clientSecret" fields are used to form a Basic
|
|
66
|
+
* Authorization header to be included in each request to the token service
|
|
67
|
+
* - scope: (optional) the "scope" parameter to use when fetching the bearer token from the token service
|
|
68
|
+
*
|
|
69
|
+
* @throws Error: the configuration options are not valid.
|
|
69
70
|
*/
|
|
70
71
|
function IamRequestBasedTokenManager(options) {
|
|
71
72
|
var _this = this;
|
|
@@ -92,26 +93,23 @@ var IamRequestBasedTokenManager = /** @class */ (function (_super) {
|
|
|
92
93
|
return _this;
|
|
93
94
|
}
|
|
94
95
|
/**
|
|
95
|
-
*
|
|
96
|
-
* This value is the form parameter
|
|
97
|
-
* from the IAM token server.
|
|
96
|
+
* Sets the IAM "scope" value.
|
|
97
|
+
* This value is sent as the "scope" form parameter within the request sent to the IAM token service.
|
|
98
98
|
*
|
|
99
|
-
* @param
|
|
100
|
-
* @returns {void}
|
|
99
|
+
* @param scope - a space-separated string that contains one or more scope names
|
|
101
100
|
*/
|
|
102
101
|
IamRequestBasedTokenManager.prototype.setScope = function (scope) {
|
|
103
102
|
this.scope = scope;
|
|
104
103
|
};
|
|
105
104
|
/**
|
|
106
|
-
*
|
|
105
|
+
* Sets the IAM "clientId" and "clientSecret" values.
|
|
107
106
|
* These values are used to compute the Authorization header used
|
|
108
107
|
* when retrieving the IAM access token.
|
|
109
108
|
* If these values are not set, no Authorization header will be
|
|
110
109
|
* set on the request (it is not required).
|
|
111
110
|
*
|
|
112
|
-
* @param
|
|
113
|
-
* @param
|
|
114
|
-
* @returns {void}
|
|
111
|
+
* @param clientId - the client id.
|
|
112
|
+
* @param clientSecret - the client secret.
|
|
115
113
|
*/
|
|
116
114
|
IamRequestBasedTokenManager.prototype.setClientIdAndSecret = function (clientId, clientSecret) {
|
|
117
115
|
this.clientId = clientId;
|
|
@@ -122,10 +120,9 @@ var IamRequestBasedTokenManager = /** @class */ (function (_super) {
|
|
|
122
120
|
}
|
|
123
121
|
};
|
|
124
122
|
/**
|
|
125
|
-
*
|
|
123
|
+
* Returns the most recently stored refresh token.
|
|
126
124
|
*
|
|
127
|
-
* @
|
|
128
|
-
* @returns {string}
|
|
125
|
+
* @returns the refresh token
|
|
129
126
|
*/
|
|
130
127
|
IamRequestBasedTokenManager.prototype.getRefreshToken = function () {
|
|
131
128
|
return this.refreshToken;
|
|
@@ -134,9 +131,7 @@ var IamRequestBasedTokenManager = /** @class */ (function (_super) {
|
|
|
134
131
|
* Extend this method from the parent class to extract the refresh token from
|
|
135
132
|
* the request and save it.
|
|
136
133
|
*
|
|
137
|
-
* @param tokenResponse -
|
|
138
|
-
* @protected
|
|
139
|
-
* @returns {void}
|
|
134
|
+
* @param tokenResponse - the response object from JWT service request
|
|
140
135
|
*/
|
|
141
136
|
IamRequestBasedTokenManager.prototype.saveTokenInfo = function (tokenResponse) {
|
|
142
137
|
_super.prototype.saveTokenInfo.call(this, tokenResponse);
|
|
@@ -146,9 +141,9 @@ var IamRequestBasedTokenManager = /** @class */ (function (_super) {
|
|
|
146
141
|
}
|
|
147
142
|
};
|
|
148
143
|
/**
|
|
149
|
-
* Request an IAM token using an API key.
|
|
144
|
+
* Request an IAM access token using an API key.
|
|
150
145
|
*
|
|
151
|
-
* @returns
|
|
146
|
+
* @returns Promise
|
|
152
147
|
*/
|
|
153
148
|
IamRequestBasedTokenManager.prototype.requestToken = function () {
|
|
154
149
|
// these cannot be overwritten
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* (C) Copyright IBM Corp. 2019,
|
|
2
|
+
* (C) Copyright IBM Corp. 2019, 2022.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -21,28 +21,29 @@ interface Options extends IamRequestOptions {
|
|
|
21
21
|
/**
|
|
22
22
|
* The IAMTokenManager takes an api key and performs the necessary interactions with
|
|
23
23
|
* the IAM token service to obtain and store a suitable bearer token. Additionally, the IAMTokenManager
|
|
24
|
-
* will retrieve bearer tokens via basic auth using a supplied
|
|
24
|
+
* will retrieve bearer tokens via basic auth using a supplied "clientId" and "clientSecret" pair.
|
|
25
25
|
*/
|
|
26
26
|
export declare class IamTokenManager extends IamRequestBasedTokenManager {
|
|
27
27
|
protected requiredOptions: string[];
|
|
28
28
|
private apikey;
|
|
29
29
|
/**
|
|
30
30
|
*
|
|
31
|
-
* Create a new
|
|
31
|
+
* Create a new IamTokenManager instance.
|
|
32
32
|
*
|
|
33
|
-
* @param
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
33
|
+
* @param options - Configuration options.
|
|
34
|
+
* This should be an object containing these fields:
|
|
35
|
+
* - url: (optional) the endpoint URL for the IAM token service (default value: "https://iam.cloud.ibm.com")
|
|
36
|
+
* - apikey: (required) the IAM api key
|
|
37
|
+
* - disableSslVerification: (optional) a flag that indicates whether verification of the token server's SSL certificate
|
|
38
|
+
* should be disabled or not
|
|
39
|
+
* - headers: (optional) a set of HTTP headers to be sent with each request to the token service
|
|
40
|
+
* - clientId: (optional) the "clientId" and "clientSecret" fields are used to form a Basic
|
|
41
|
+
* Authorization header to be included in each request to the token service
|
|
42
|
+
* - clientSecret: (optional) the "clientId" and "clientSecret" fields are used to form a Basic
|
|
43
|
+
* Authorization header to be included in each request to the token service
|
|
44
|
+
* - scope: (optional) the "scope" parameter to use when fetching the bearer token from the token service
|
|
45
|
+
*
|
|
46
|
+
* @throws Error: the configuration options are not valid.
|
|
46
47
|
*/
|
|
47
48
|
constructor(options: Options);
|
|
48
49
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* (C) Copyright IBM Corp. 2019,
|
|
3
|
+
* (C) Copyright IBM Corp. 2019, 2022.
|
|
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.
|
|
@@ -36,27 +36,28 @@ var iam_request_based_token_manager_1 = require("./iam-request-based-token-manag
|
|
|
36
36
|
/**
|
|
37
37
|
* The IAMTokenManager takes an api key and performs the necessary interactions with
|
|
38
38
|
* the IAM token service to obtain and store a suitable bearer token. Additionally, the IAMTokenManager
|
|
39
|
-
* will retrieve bearer tokens via basic auth using a supplied
|
|
39
|
+
* will retrieve bearer tokens via basic auth using a supplied "clientId" and "clientSecret" pair.
|
|
40
40
|
*/
|
|
41
41
|
var IamTokenManager = /** @class */ (function (_super) {
|
|
42
42
|
__extends(IamTokenManager, _super);
|
|
43
43
|
/**
|
|
44
44
|
*
|
|
45
|
-
* Create a new
|
|
45
|
+
* Create a new IamTokenManager instance.
|
|
46
46
|
*
|
|
47
|
-
* @param
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
47
|
+
* @param options - Configuration options.
|
|
48
|
+
* This should be an object containing these fields:
|
|
49
|
+
* - url: (optional) the endpoint URL for the IAM token service (default value: "https://iam.cloud.ibm.com")
|
|
50
|
+
* - apikey: (required) the IAM api key
|
|
51
|
+
* - disableSslVerification: (optional) a flag that indicates whether verification of the token server's SSL certificate
|
|
52
|
+
* should be disabled or not
|
|
53
|
+
* - headers: (optional) a set of HTTP headers to be sent with each request to the token service
|
|
54
|
+
* - clientId: (optional) the "clientId" and "clientSecret" fields are used to form a Basic
|
|
55
|
+
* Authorization header to be included in each request to the token service
|
|
56
|
+
* - clientSecret: (optional) the "clientId" and "clientSecret" fields are used to form a Basic
|
|
57
|
+
* Authorization header to be included in each request to the token service
|
|
58
|
+
* - scope: (optional) the "scope" parameter to use when fetching the bearer token from the token service
|
|
59
|
+
*
|
|
60
|
+
* @throws Error: the configuration options are not valid.
|
|
60
61
|
*/
|
|
61
62
|
function IamTokenManager(options) {
|
|
62
63
|
var _this = _super.call(this, options) || this;
|
|
@@ -11,29 +11,26 @@ export declare class JwtTokenManager extends TokenManager {
|
|
|
11
11
|
protected tokenName: string;
|
|
12
12
|
protected tokenInfo: any;
|
|
13
13
|
/**
|
|
14
|
-
* Create a new
|
|
15
|
-
*
|
|
16
|
-
* @param
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* outbound HTTP requests to token services.
|
|
14
|
+
* Create a new JwtTokenManager instance.
|
|
15
|
+
*
|
|
16
|
+
* @param options - Configuration options.
|
|
17
|
+
* This should be an object containing these fields:
|
|
18
|
+
* - url: (optional) the endpoint URL for the token service
|
|
19
|
+
* - disableSslVerification: (optional) a flag that indicates whether verification of the token server's SSL certificate
|
|
20
|
+
* should be disabled or not
|
|
21
|
+
* - headers: (optional) a set of HTTP headers to be sent with each request to the token service
|
|
23
22
|
*/
|
|
24
23
|
constructor(options: JwtTokenManagerOptions);
|
|
25
24
|
/**
|
|
26
25
|
* Request a JWT using an API key.
|
|
27
26
|
*
|
|
28
|
-
* @returns
|
|
27
|
+
* @returns Promise
|
|
29
28
|
*/
|
|
30
29
|
protected requestToken(): Promise<any>;
|
|
31
30
|
/**
|
|
32
31
|
* Save the JWT service response and the calculated expiration time to the object's state.
|
|
33
32
|
*
|
|
34
|
-
* @param tokenResponse -
|
|
35
|
-
* @protected
|
|
36
|
-
* @returns {void}
|
|
33
|
+
* @param tokenResponse - the response object from JWT service request
|
|
37
34
|
*/
|
|
38
35
|
protected saveTokenInfo(tokenResponse: any): void;
|
|
39
36
|
}
|
|
@@ -32,7 +32,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
32
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
33
|
exports.JwtTokenManager = void 0;
|
|
34
34
|
/**
|
|
35
|
-
* (C) Copyright IBM Corp. 2019,
|
|
35
|
+
* (C) Copyright IBM Corp. 2019, 2022.
|
|
36
36
|
*
|
|
37
37
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
38
38
|
* you may not use this file except in compliance with the License.
|
|
@@ -58,15 +58,14 @@ var token_manager_1 = require("./token-manager");
|
|
|
58
58
|
var JwtTokenManager = /** @class */ (function (_super) {
|
|
59
59
|
__extends(JwtTokenManager, _super);
|
|
60
60
|
/**
|
|
61
|
-
* Create a new
|
|
62
|
-
*
|
|
63
|
-
* @param
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* outbound HTTP requests to token services.
|
|
61
|
+
* Create a new JwtTokenManager instance.
|
|
62
|
+
*
|
|
63
|
+
* @param options - Configuration options.
|
|
64
|
+
* This should be an object containing these fields:
|
|
65
|
+
* - url: (optional) the endpoint URL for the token service
|
|
66
|
+
* - disableSslVerification: (optional) a flag that indicates whether verification of the token server's SSL certificate
|
|
67
|
+
* should be disabled or not
|
|
68
|
+
* - headers: (optional) a set of HTTP headers to be sent with each request to the token service
|
|
70
69
|
*/
|
|
71
70
|
function JwtTokenManager(options) {
|
|
72
71
|
var _this = this;
|
|
@@ -80,7 +79,7 @@ var JwtTokenManager = /** @class */ (function (_super) {
|
|
|
80
79
|
/**
|
|
81
80
|
* Request a JWT using an API key.
|
|
82
81
|
*
|
|
83
|
-
* @returns
|
|
82
|
+
* @returns Promise
|
|
84
83
|
*/
|
|
85
84
|
JwtTokenManager.prototype.requestToken = function () {
|
|
86
85
|
var errMsg = '`requestToken` MUST be overridden by a subclass of JwtTokenManagerV1.';
|
|
@@ -91,9 +90,7 @@ var JwtTokenManager = /** @class */ (function (_super) {
|
|
|
91
90
|
/**
|
|
92
91
|
* Save the JWT service response and the calculated expiration time to the object's state.
|
|
93
92
|
*
|
|
94
|
-
* @param tokenResponse -
|
|
95
|
-
* @protected
|
|
96
|
-
* @returns {void}
|
|
93
|
+
* @param tokenResponse - the response object from JWT service request
|
|
97
94
|
*/
|
|
98
95
|
JwtTokenManager.prototype.saveTokenInfo = function (tokenResponse) {
|
|
99
96
|
var responseBody = tokenResponse.result || {};
|
|
@@ -103,14 +100,14 @@ var JwtTokenManager = /** @class */ (function (_super) {
|
|
|
103
100
|
logger_1.default.error(err);
|
|
104
101
|
throw new Error(err);
|
|
105
102
|
}
|
|
106
|
-
// the time of expiration is found by decoding the JWT access token
|
|
107
|
-
// exp is the time of expire and iat is the time of token retrieval
|
|
108
103
|
var decodedResponse = (0, jsonwebtoken_1.decode)(this.accessToken);
|
|
109
104
|
if (!decodedResponse) {
|
|
110
105
|
var err = 'Access token recieved is not a valid JWT';
|
|
111
106
|
logger_1.default.error(err);
|
|
112
107
|
throw new Error(err);
|
|
113
108
|
}
|
|
109
|
+
// the time of expiration is found by decoding the JWT access token
|
|
110
|
+
// 'exp' is the time of expire and 'iat' is the time of token retrieval
|
|
114
111
|
var exp = decodedResponse.exp, iat = decodedResponse.iat;
|
|
115
112
|
// There are no required claims in JWT
|
|
116
113
|
if (!exp || !iat) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/**
|
|
3
|
-
* (C) Copyright IBM Corp. 2020,
|
|
3
|
+
* (C) Copyright IBM Corp. 2020, 2022.
|
|
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.
|
|
@@ -33,8 +33,8 @@ export type TokenManagerOptions = {
|
|
|
33
33
|
/**
|
|
34
34
|
* A class for shared functionality for storing, and requesting tokens.
|
|
35
35
|
* Intended to be used as a parent to be extended for token request management.
|
|
36
|
-
* Child classes should implement
|
|
37
|
-
* from intended sources and
|
|
36
|
+
* Child classes should implement "requestToken()" to retrieve the token
|
|
37
|
+
* from intended sources and "saveTokenInfo(tokenResponse)" to parse and save
|
|
38
38
|
* token information from the response.
|
|
39
39
|
*/
|
|
40
40
|
export declare class TokenManager {
|
|
@@ -48,40 +48,36 @@ export declare class TokenManager {
|
|
|
48
48
|
private requestTime;
|
|
49
49
|
private pendingRequests;
|
|
50
50
|
/**
|
|
51
|
-
* Create a new
|
|
52
|
-
*
|
|
53
|
-
* @param
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* outbound HTTP requests to token services.
|
|
51
|
+
* Create a new TokenManager instance.
|
|
52
|
+
*
|
|
53
|
+
* @param options - Configuration options.
|
|
54
|
+
* This should be an object containing these fields:
|
|
55
|
+
* - url: (optional) the endpoint URL for the token service
|
|
56
|
+
* - disableSslVerification: (optional) a flag that indicates whether verification of the token server's SSL certificate
|
|
57
|
+
* should be disabled or not
|
|
58
|
+
* - headers: (optional) a set of HTTP headers to be sent with each request to the token service
|
|
60
59
|
*/
|
|
61
60
|
constructor(options: TokenManagerOptions);
|
|
62
61
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
62
|
+
* Retrieves a new token using "requestToken()" if there is not a
|
|
63
|
+
* currently stored token from a previous call, or the previous token
|
|
64
|
+
* has expired.
|
|
66
65
|
*/
|
|
67
66
|
getToken(): Promise<any>;
|
|
68
67
|
/**
|
|
69
|
-
*
|
|
68
|
+
* Sets the "disableSslVerification" property.
|
|
70
69
|
*
|
|
71
|
-
* @param
|
|
72
|
-
* property
|
|
73
|
-
* @returns {void}
|
|
70
|
+
* @param value - the new value for the disableSslVerification property
|
|
74
71
|
*/
|
|
75
72
|
setDisableSslVerification(value: boolean): void;
|
|
76
73
|
/**
|
|
77
|
-
*
|
|
74
|
+
* Sets the headers to be included with each outbound request to the token server.
|
|
78
75
|
*
|
|
79
|
-
* @param
|
|
80
|
-
* @returns {void}
|
|
76
|
+
* @param headers - the set of headers to send with each request to the token server
|
|
81
77
|
*/
|
|
82
78
|
setHeaders(headers: OutgoingHttpHeaders): void;
|
|
83
79
|
/**
|
|
84
|
-
* Paces requests to
|
|
80
|
+
* Paces requests to requestToken().
|
|
85
81
|
*
|
|
86
82
|
* This method pseudo-serializes requests for an access_token
|
|
87
83
|
* when the current token is undefined or expired.
|
|
@@ -95,7 +91,7 @@ export declare class TokenManager {
|
|
|
95
91
|
/**
|
|
96
92
|
* Request a token using an API endpoint.
|
|
97
93
|
*
|
|
98
|
-
* @returns
|
|
94
|
+
* @returns Promise
|
|
99
95
|
*/
|
|
100
96
|
protected requestToken(): Promise<any>;
|
|
101
97
|
/**
|
|
@@ -104,24 +100,16 @@ export declare class TokenManager {
|
|
|
104
100
|
* Calculate expiration and refresh time from the received info
|
|
105
101
|
* and store them in fields `expireTime` and `refreshTime`.
|
|
106
102
|
*
|
|
107
|
-
* @param tokenResponse -
|
|
108
|
-
* @protected
|
|
109
|
-
* @returns {void}
|
|
103
|
+
* @param tokenResponse - the response object from a token service request
|
|
110
104
|
*/
|
|
111
105
|
protected saveTokenInfo(tokenResponse: any): void;
|
|
112
106
|
/**
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
* @private
|
|
116
|
-
* @returns {boolean}
|
|
107
|
+
* Checks if currently-stored token is expired
|
|
117
108
|
*/
|
|
118
109
|
private isTokenExpired;
|
|
119
110
|
/**
|
|
120
|
-
*
|
|
111
|
+
* Checks if currently-stored token should be refreshed
|
|
121
112
|
* i.e. past the window to request a new token
|
|
122
|
-
*
|
|
123
|
-
* @private
|
|
124
|
-
* @returns {boolean}
|
|
125
113
|
*/
|
|
126
114
|
private tokenNeedsRefresh;
|
|
127
115
|
}
|
|
@@ -12,21 +12,20 @@ var utils_1 = require("../utils");
|
|
|
12
12
|
/**
|
|
13
13
|
* A class for shared functionality for storing, and requesting tokens.
|
|
14
14
|
* Intended to be used as a parent to be extended for token request management.
|
|
15
|
-
* Child classes should implement
|
|
16
|
-
* from intended sources and
|
|
15
|
+
* Child classes should implement "requestToken()" to retrieve the token
|
|
16
|
+
* from intended sources and "saveTokenInfo(tokenResponse)" to parse and save
|
|
17
17
|
* token information from the response.
|
|
18
18
|
*/
|
|
19
19
|
var TokenManager = /** @class */ (function () {
|
|
20
20
|
/**
|
|
21
|
-
* Create a new
|
|
22
|
-
*
|
|
23
|
-
* @param
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* outbound HTTP requests to token services.
|
|
21
|
+
* Create a new TokenManager instance.
|
|
22
|
+
*
|
|
23
|
+
* @param options - Configuration options.
|
|
24
|
+
* This should be an object containing these fields:
|
|
25
|
+
* - url: (optional) the endpoint URL for the token service
|
|
26
|
+
* - disableSslVerification: (optional) a flag that indicates whether verification of the token server's SSL certificate
|
|
27
|
+
* should be disabled or not
|
|
28
|
+
* - headers: (optional) a set of HTTP headers to be sent with each request to the token service
|
|
30
29
|
*/
|
|
31
30
|
function TokenManager(options) {
|
|
32
31
|
// all parameters are optional
|
|
@@ -43,9 +42,9 @@ var TokenManager = /** @class */ (function () {
|
|
|
43
42
|
this.pendingRequests = [];
|
|
44
43
|
}
|
|
45
44
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
45
|
+
* Retrieves a new token using "requestToken()" if there is not a
|
|
46
|
+
* currently stored token from a previous call, or the previous token
|
|
47
|
+
* has expired.
|
|
49
48
|
*/
|
|
50
49
|
TokenManager.prototype.getToken = function () {
|
|
51
50
|
var _this = this;
|
|
@@ -63,11 +62,9 @@ var TokenManager = /** @class */ (function () {
|
|
|
63
62
|
return Promise.resolve(this.accessToken);
|
|
64
63
|
};
|
|
65
64
|
/**
|
|
66
|
-
*
|
|
65
|
+
* Sets the "disableSslVerification" property.
|
|
67
66
|
*
|
|
68
|
-
* @param
|
|
69
|
-
* property
|
|
70
|
-
* @returns {void}
|
|
67
|
+
* @param value - the new value for the disableSslVerification property
|
|
71
68
|
*/
|
|
72
69
|
TokenManager.prototype.setDisableSslVerification = function (value) {
|
|
73
70
|
// if they try to pass in a non-boolean value,
|
|
@@ -75,10 +72,9 @@ var TokenManager = /** @class */ (function () {
|
|
|
75
72
|
this.disableSslVerification = Boolean(value);
|
|
76
73
|
};
|
|
77
74
|
/**
|
|
78
|
-
*
|
|
75
|
+
* Sets the headers to be included with each outbound request to the token server.
|
|
79
76
|
*
|
|
80
|
-
* @param
|
|
81
|
-
* @returns {void}
|
|
77
|
+
* @param headers - the set of headers to send with each request to the token server
|
|
82
78
|
*/
|
|
83
79
|
TokenManager.prototype.setHeaders = function (headers) {
|
|
84
80
|
if (typeof headers !== 'object') {
|
|
@@ -88,7 +84,7 @@ var TokenManager = /** @class */ (function () {
|
|
|
88
84
|
this.headers = headers;
|
|
89
85
|
};
|
|
90
86
|
/**
|
|
91
|
-
* Paces requests to
|
|
87
|
+
* Paces requests to requestToken().
|
|
92
88
|
*
|
|
93
89
|
* This method pseudo-serializes requests for an access_token
|
|
94
90
|
* when the current token is undefined or expired.
|
|
@@ -129,7 +125,7 @@ var TokenManager = /** @class */ (function () {
|
|
|
129
125
|
/**
|
|
130
126
|
* Request a token using an API endpoint.
|
|
131
127
|
*
|
|
132
|
-
* @returns
|
|
128
|
+
* @returns Promise
|
|
133
129
|
*/
|
|
134
130
|
TokenManager.prototype.requestToken = function () {
|
|
135
131
|
var errMsg = '`requestToken` MUST be overridden by a subclass of TokenManagerV1.';
|
|
@@ -143,19 +139,14 @@ var TokenManager = /** @class */ (function () {
|
|
|
143
139
|
* Calculate expiration and refresh time from the received info
|
|
144
140
|
* and store them in fields `expireTime` and `refreshTime`.
|
|
145
141
|
*
|
|
146
|
-
* @param tokenResponse -
|
|
147
|
-
* @protected
|
|
148
|
-
* @returns {void}
|
|
142
|
+
* @param tokenResponse - the response object from a token service request
|
|
149
143
|
*/
|
|
150
144
|
TokenManager.prototype.saveTokenInfo = function (tokenResponse) {
|
|
151
145
|
var errMsg = '`saveTokenInfo` MUST be overridden by a subclass of TokenManager.';
|
|
152
146
|
logger_1.default.error(errMsg);
|
|
153
147
|
};
|
|
154
148
|
/**
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
* @private
|
|
158
|
-
* @returns {boolean}
|
|
149
|
+
* Checks if currently-stored token is expired
|
|
159
150
|
*/
|
|
160
151
|
TokenManager.prototype.isTokenExpired = function () {
|
|
161
152
|
var expireTime = this.expireTime;
|
|
@@ -166,11 +157,8 @@ var TokenManager = /** @class */ (function () {
|
|
|
166
157
|
return expireTime <= currentTime;
|
|
167
158
|
};
|
|
168
159
|
/**
|
|
169
|
-
*
|
|
160
|
+
* Checks if currently-stored token should be refreshed
|
|
170
161
|
* i.e. past the window to request a new token
|
|
171
|
-
*
|
|
172
|
-
* @private
|
|
173
|
-
* @returns {boolean}
|
|
174
162
|
*/
|
|
175
163
|
TokenManager.prototype.tokenNeedsRefresh = function () {
|
|
176
164
|
var refreshTime = this.refreshTime;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* (C) Copyright IBM Corp. 2021.
|
|
2
|
+
* (C) Copyright IBM Corp. 2021, 2022.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -28,27 +28,27 @@ export declare class VpcInstanceTokenManager extends JwtTokenManager {
|
|
|
28
28
|
private iamProfileCrn;
|
|
29
29
|
private iamProfileId;
|
|
30
30
|
/**
|
|
31
|
-
* Create a new
|
|
31
|
+
* Create a new VpcInstanceTokenManager instance.
|
|
32
32
|
*
|
|
33
|
-
* @param
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
33
|
+
* @param options - Configuration options.
|
|
34
|
+
* This should be an object containing these fields:
|
|
35
|
+
* - url: (optional) the endpoint URL for the VPC Instance Metadata Service (default value: "http://169.254.169.254")
|
|
36
|
+
* - iamProfileCrn: (optional) the CRN of the linked IAM trusted profile to be used to obtain the IAM access token
|
|
37
|
+
* - iamProfileId: (optional) the ID of the linked IAM trusted profile to be used to obtain the IAM access token
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* At most one of "iamProfileCrn" or "iamProfileId" may be specified. If neither one is specified,
|
|
41
|
+
* then the default IAM profile defined for the compute resource will be used.
|
|
42
42
|
*/
|
|
43
43
|
constructor(options: Options);
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
46
|
-
* @param
|
|
45
|
+
* Sets the CRN of the IAM trusted profile to use when fetching the access token from the IAM token server.
|
|
46
|
+
* @param iamProfileCrn - the CRN of the IAM trusted profile
|
|
47
47
|
*/
|
|
48
48
|
setIamProfileCrn(iamProfileCrn: string): void;
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
51
|
-
* @param
|
|
50
|
+
* Sets the Id of the IAM trusted profile to use when fetching the access token from the IAM token server.
|
|
51
|
+
* @param iamProfileId - the ID of the IAM trusted profile
|
|
52
52
|
*/
|
|
53
53
|
setIamProfileId(iamProfileId: string): void;
|
|
54
54
|
protected requestToken(): Promise<any>;
|