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. 2021.
|
|
3
|
+
* (C) Copyright IBM Corp. 2021, 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.
|
|
@@ -81,17 +81,17 @@ var METADATA_SERVICE_VERSION = '2021-09-20';
|
|
|
81
81
|
var VpcInstanceTokenManager = /** @class */ (function (_super) {
|
|
82
82
|
__extends(VpcInstanceTokenManager, _super);
|
|
83
83
|
/**
|
|
84
|
-
* Create a new
|
|
84
|
+
* Create a new VpcInstanceTokenManager instance.
|
|
85
85
|
*
|
|
86
|
-
* @param
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
86
|
+
* @param options - Configuration options.
|
|
87
|
+
* This should be an object containing these fields:
|
|
88
|
+
* - url: (optional) the endpoint URL for the VPC Instance Metadata Service (default value: "http://169.254.169.254")
|
|
89
|
+
* - iamProfileCrn: (optional) the CRN of the linked IAM trusted profile to be used to obtain the IAM access token
|
|
90
|
+
* - iamProfileId: (optional) the ID of the linked IAM trusted profile to be used to obtain the IAM access token
|
|
91
|
+
*
|
|
92
|
+
* @remarks
|
|
93
|
+
* At most one of "iamProfileCrn" or "iamProfileId" may be specified. If neither one is specified,
|
|
94
|
+
* then the default IAM profile defined for the compute resource will be used.
|
|
95
95
|
*/
|
|
96
96
|
function VpcInstanceTokenManager(options) {
|
|
97
97
|
var _this = this;
|
|
@@ -111,15 +111,15 @@ var VpcInstanceTokenManager = /** @class */ (function (_super) {
|
|
|
111
111
|
return _this;
|
|
112
112
|
}
|
|
113
113
|
/**
|
|
114
|
-
*
|
|
115
|
-
* @param
|
|
114
|
+
* Sets the CRN of the IAM trusted profile to use when fetching the access token from the IAM token server.
|
|
115
|
+
* @param iamProfileCrn - the CRN of the IAM trusted profile
|
|
116
116
|
*/
|
|
117
117
|
VpcInstanceTokenManager.prototype.setIamProfileCrn = function (iamProfileCrn) {
|
|
118
118
|
this.iamProfileCrn = iamProfileCrn;
|
|
119
119
|
};
|
|
120
120
|
/**
|
|
121
|
-
*
|
|
122
|
-
* @param
|
|
121
|
+
* Sets the Id of the IAM trusted profile to use when fetching the access token from the IAM token server.
|
|
122
|
+
* @param iamProfileId - the ID of the IAM trusted profile
|
|
123
123
|
*/
|
|
124
124
|
VpcInstanceTokenManager.prototype.setIamProfileId = function (iamProfileId) {
|
|
125
125
|
this.iamProfileId = iamProfileId;
|
|
@@ -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.
|
|
@@ -22,7 +22,7 @@ import { Authenticator } from '../authenticators';
|
|
|
22
22
|
* 2. Environment variables
|
|
23
23
|
* 3. VCAP Services (Cloud Foundry)
|
|
24
24
|
*
|
|
25
|
-
* @param
|
|
25
|
+
* @param serviceName - the service name prefix.
|
|
26
26
|
*
|
|
27
27
|
*/
|
|
28
28
|
export declare function getAuthenticatorFromEnvironment(serviceName: string): Authenticator;
|
|
@@ -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.
|
|
@@ -26,7 +26,7 @@ var read_external_sources_1 = require("./read-external-sources");
|
|
|
26
26
|
* 2. Environment variables
|
|
27
27
|
* 3. VCAP Services (Cloud Foundry)
|
|
28
28
|
*
|
|
29
|
-
* @param
|
|
29
|
+
* @param serviceName - the service name prefix.
|
|
30
30
|
*
|
|
31
31
|
*/
|
|
32
32
|
function getAuthenticatorFromEnvironment(serviceName) {
|
package/auth/utils/helpers.d.ts
CHANGED
|
@@ -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.
|
|
@@ -16,66 +16,68 @@
|
|
|
16
16
|
/**
|
|
17
17
|
* Compute and return a Basic Authorization header from a username and password.
|
|
18
18
|
*
|
|
19
|
-
* @param
|
|
20
|
-
* @param
|
|
21
|
-
* @returns
|
|
19
|
+
* @param username - The username or client id
|
|
20
|
+
* @param password - The password or client secret
|
|
21
|
+
* @returns a Basic Auth header with format "Basic <encoded-credentials>"
|
|
22
22
|
*/
|
|
23
23
|
export declare function computeBasicAuthHeader(username: string, password: string): string;
|
|
24
24
|
/**
|
|
25
|
-
* Checks credentials for common user mistakes of copying {, }, or " characters from the documentation
|
|
25
|
+
* Checks credentials for common user mistakes of copying \{, \}, or \" characters from the documentation
|
|
26
26
|
*
|
|
27
|
-
* @param
|
|
28
|
-
* @param
|
|
29
|
-
* @returns
|
|
27
|
+
* @param obj - the options object holding credentials
|
|
28
|
+
* @param credsToCheck - an array containing the keys of the credentials to check for problems
|
|
29
|
+
* @returns a string with the error message if there were problems, null if not
|
|
30
30
|
*/
|
|
31
31
|
export declare function checkCredentials(obj: any, credsToCheck: string[]): Error | null;
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
34
|
-
* @param
|
|
33
|
+
* Validates "options".
|
|
34
|
+
* @param options - a configuration options object
|
|
35
|
+
* @param requiredOptions - the list of properties that must be present in "options"
|
|
36
|
+
*
|
|
37
|
+
* @throws Error: "options" failed validation
|
|
35
38
|
*/
|
|
36
39
|
export declare function validateInput(options: any, requiredOptions: string[]): void;
|
|
37
40
|
/**
|
|
38
|
-
*
|
|
41
|
+
* Gets the current time.
|
|
39
42
|
*
|
|
40
|
-
* @returns
|
|
43
|
+
* @returns the current time in seconds.
|
|
41
44
|
*/
|
|
42
45
|
export declare function getCurrentTime(): number;
|
|
43
46
|
/**
|
|
44
|
-
*
|
|
47
|
+
* Checks for only one of two elements being defined.
|
|
45
48
|
* Returns true if a is defined and b is undefined,
|
|
46
49
|
* or vice versa. Returns false if both are defined
|
|
47
50
|
* or both are undefined.
|
|
48
51
|
*
|
|
49
|
-
* @param
|
|
50
|
-
* @param
|
|
51
|
-
* @returns
|
|
52
|
+
* @param a - The first object
|
|
53
|
+
* @param b - The second object
|
|
54
|
+
* @returns true if and only if exactly one of a or b is defined
|
|
52
55
|
*/
|
|
53
56
|
export declare function onlyOne(a: any, b: any): boolean;
|
|
54
57
|
/**
|
|
55
|
-
*
|
|
58
|
+
* Removes a given suffix if it exists.
|
|
59
|
+
*
|
|
60
|
+
* @param str - the base string to operate on
|
|
61
|
+
* @param suffix - the suffix to remove, if present
|
|
56
62
|
*
|
|
57
|
-
* @
|
|
58
|
-
* @param {string} suffix - The suffix to remove, if present
|
|
59
|
-
* @returns {string}
|
|
63
|
+
* @returns the substring of "str" that remains after the suffix is removed
|
|
60
64
|
*/
|
|
61
65
|
export declare function removeSuffix(str: string, suffix: string): string;
|
|
62
66
|
/**
|
|
63
|
-
*
|
|
64
|
-
* Returns true if a or b is defined. Returns false if
|
|
65
|
-
* both are undefined.
|
|
67
|
+
* Checks for at least one of two elements being defined.
|
|
66
68
|
*
|
|
67
|
-
* @param
|
|
68
|
-
* @param
|
|
69
|
-
* @returns
|
|
69
|
+
* @param a - the first object
|
|
70
|
+
* @param b - the second object
|
|
71
|
+
* @returns true if a or b is defined; false if both are undefined
|
|
70
72
|
*/
|
|
71
73
|
export declare function atLeastOne(a: any, b: any): boolean;
|
|
72
74
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
75
|
+
* Verifies that both properties are not specified.
|
|
76
|
+
*
|
|
77
|
+
* @param a - The first object
|
|
78
|
+
* @param b - The second object
|
|
76
79
|
*
|
|
77
|
-
* @
|
|
78
|
-
|
|
79
|
-
* @returns {boolean}
|
|
80
|
+
* @returns false if a and b are both defined, true otherwise
|
|
81
|
+
|
|
80
82
|
*/
|
|
81
83
|
export declare function atMostOne(a: any, b: any): boolean;
|
package/auth/utils/helpers.js
CHANGED
|
@@ -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.
|
|
@@ -20,9 +20,9 @@ var helper_1 = require("../../lib/helper");
|
|
|
20
20
|
/**
|
|
21
21
|
* Compute and return a Basic Authorization header from a username and password.
|
|
22
22
|
*
|
|
23
|
-
* @param
|
|
24
|
-
* @param
|
|
25
|
-
* @returns
|
|
23
|
+
* @param username - The username or client id
|
|
24
|
+
* @param password - The password or client secret
|
|
25
|
+
* @returns a Basic Auth header with format "Basic <encoded-credentials>"
|
|
26
26
|
*/
|
|
27
27
|
function computeBasicAuthHeader(username, password) {
|
|
28
28
|
var encodedCreds = Buffer.from("".concat(username, ":").concat(password)).toString('base64');
|
|
@@ -35,11 +35,11 @@ function badCharAtAnEnd(value) {
|
|
|
35
35
|
return (value.startsWith('{') || value.startsWith('"') || value.endsWith('}') || value.endsWith('"'));
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
|
-
* Checks credentials for common user mistakes of copying {, }, or " characters from the documentation
|
|
38
|
+
* Checks credentials for common user mistakes of copying \{, \}, or \" characters from the documentation
|
|
39
39
|
*
|
|
40
|
-
* @param
|
|
41
|
-
* @param
|
|
42
|
-
* @returns
|
|
40
|
+
* @param obj - the options object holding credentials
|
|
41
|
+
* @param credsToCheck - an array containing the keys of the credentials to check for problems
|
|
42
|
+
* @returns a string with the error message if there were problems, null if not
|
|
43
43
|
*/
|
|
44
44
|
function checkCredentials(obj, credsToCheck) {
|
|
45
45
|
var errorMessage = '';
|
|
@@ -57,8 +57,11 @@ function checkCredentials(obj, credsToCheck) {
|
|
|
57
57
|
}
|
|
58
58
|
exports.checkCredentials = checkCredentials;
|
|
59
59
|
/**
|
|
60
|
-
*
|
|
61
|
-
* @param
|
|
60
|
+
* Validates "options".
|
|
61
|
+
* @param options - a configuration options object
|
|
62
|
+
* @param requiredOptions - the list of properties that must be present in "options"
|
|
63
|
+
*
|
|
64
|
+
* @throws Error: "options" failed validation
|
|
62
65
|
*/
|
|
63
66
|
function validateInput(options, requiredOptions) {
|
|
64
67
|
// check for required params
|
|
@@ -76,34 +79,35 @@ function validateInput(options, requiredOptions) {
|
|
|
76
79
|
}
|
|
77
80
|
exports.validateInput = validateInput;
|
|
78
81
|
/**
|
|
79
|
-
*
|
|
82
|
+
* Gets the current time.
|
|
80
83
|
*
|
|
81
|
-
* @returns
|
|
84
|
+
* @returns the current time in seconds.
|
|
82
85
|
*/
|
|
83
86
|
function getCurrentTime() {
|
|
84
87
|
return Math.floor(Date.now() / 1000);
|
|
85
88
|
}
|
|
86
89
|
exports.getCurrentTime = getCurrentTime;
|
|
87
90
|
/**
|
|
88
|
-
*
|
|
91
|
+
* Checks for only one of two elements being defined.
|
|
89
92
|
* Returns true if a is defined and b is undefined,
|
|
90
93
|
* or vice versa. Returns false if both are defined
|
|
91
94
|
* or both are undefined.
|
|
92
95
|
*
|
|
93
|
-
* @param
|
|
94
|
-
* @param
|
|
95
|
-
* @returns
|
|
96
|
+
* @param a - The first object
|
|
97
|
+
* @param b - The second object
|
|
98
|
+
* @returns true if and only if exactly one of a or b is defined
|
|
96
99
|
*/
|
|
97
100
|
function onlyOne(a, b) {
|
|
98
101
|
return Boolean((a && !b) || (b && !a));
|
|
99
102
|
}
|
|
100
103
|
exports.onlyOne = onlyOne;
|
|
101
104
|
/**
|
|
102
|
-
*
|
|
105
|
+
* Removes a given suffix if it exists.
|
|
106
|
+
*
|
|
107
|
+
* @param str - the base string to operate on
|
|
108
|
+
* @param suffix - the suffix to remove, if present
|
|
103
109
|
*
|
|
104
|
-
* @
|
|
105
|
-
* @param {string} suffix - The suffix to remove, if present
|
|
106
|
-
* @returns {string}
|
|
110
|
+
* @returns the substring of "str" that remains after the suffix is removed
|
|
107
111
|
*/
|
|
108
112
|
function removeSuffix(str, suffix) {
|
|
109
113
|
if (str.endsWith(suffix)) {
|
|
@@ -113,26 +117,24 @@ function removeSuffix(str, suffix) {
|
|
|
113
117
|
}
|
|
114
118
|
exports.removeSuffix = removeSuffix;
|
|
115
119
|
/**
|
|
116
|
-
*
|
|
117
|
-
* Returns true if a or b is defined. Returns false if
|
|
118
|
-
* both are undefined.
|
|
120
|
+
* Checks for at least one of two elements being defined.
|
|
119
121
|
*
|
|
120
|
-
* @param
|
|
121
|
-
* @param
|
|
122
|
-
* @returns
|
|
122
|
+
* @param a - the first object
|
|
123
|
+
* @param b - the second object
|
|
124
|
+
* @returns true if a or b is defined; false if both are undefined
|
|
123
125
|
*/
|
|
124
126
|
function atLeastOne(a, b) {
|
|
125
127
|
return Boolean(a || b);
|
|
126
128
|
}
|
|
127
129
|
exports.atLeastOne = atLeastOne;
|
|
128
130
|
/**
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
131
|
+
* Verifies that both properties are not specified.
|
|
132
|
+
*
|
|
133
|
+
* @param a - The first object
|
|
134
|
+
* @param b - The second object
|
|
132
135
|
*
|
|
133
|
-
* @
|
|
134
|
-
|
|
135
|
-
* @returns {boolean}
|
|
136
|
+
* @returns false if a and b are both defined, true otherwise
|
|
137
|
+
|
|
136
138
|
*/
|
|
137
139
|
function atMostOne(a, b) {
|
|
138
140
|
return Boolean(!(a && b));
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* and will be converted to lower camel case.
|
|
6
6
|
*
|
|
7
7
|
* Only one source will be used at a time.
|
|
8
|
-
*
|
|
8
|
+
*
|
|
9
|
+
* @param serviceName - the service name prefix
|
|
9
10
|
*/
|
|
10
11
|
export declare function readExternalSources(serviceName: string): any;
|
|
@@ -6,7 +6,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.readExternalSources = void 0;
|
|
8
8
|
/**
|
|
9
|
-
* (C) Copyright IBM Corp. 2019,
|
|
9
|
+
* (C) Copyright IBM Corp. 2019, 2022.
|
|
10
10
|
*
|
|
11
11
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
12
|
* you may not use this file except in compliance with the License.
|
|
@@ -31,7 +31,8 @@ var file_reading_helpers_1 = require("./file-reading-helpers");
|
|
|
31
31
|
* and will be converted to lower camel case.
|
|
32
32
|
*
|
|
33
33
|
* Only one source will be used at a time.
|
|
34
|
-
*
|
|
34
|
+
*
|
|
35
|
+
* @param serviceName - the service name prefix
|
|
35
36
|
*/
|
|
36
37
|
function readExternalSources(serviceName) {
|
|
37
38
|
if (!serviceName) {
|
|
@@ -64,8 +65,8 @@ function getProperties(serviceName) {
|
|
|
64
65
|
* For example, if service.name is speech_to_text,
|
|
65
66
|
* env properties are SPEECH_TO_TEXT_USERNAME and SPEECH_TO_TEXT_PASSWORD
|
|
66
67
|
*
|
|
67
|
-
* @param
|
|
68
|
-
* @returns
|
|
68
|
+
* @param envObj - the object containing the credentials keyed by environment variables
|
|
69
|
+
* @returns the set of credentials
|
|
69
70
|
*/
|
|
70
71
|
function filterPropertiesByServiceName(envObj, serviceName) {
|
|
71
72
|
var credentials = {};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## atLeastOne() function
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Checks for at least one of two elements being defined.
|
|
8
8
|
|
|
9
9
|
<b>Signature:</b>
|
|
10
10
|
|
|
@@ -16,12 +16,12 @@ export declare function atLeastOne(a: any, b: any): boolean;
|
|
|
16
16
|
|
|
17
17
|
| Parameter | Type | Description |
|
|
18
18
|
| --- | --- | --- |
|
|
19
|
-
| a | any |
|
|
20
|
-
| b | any |
|
|
19
|
+
| a | any | the first object |
|
|
20
|
+
| b | any | the second object |
|
|
21
21
|
|
|
22
22
|
<b>Returns:</b>
|
|
23
23
|
|
|
24
24
|
boolean
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
true if a or b is defined; false if both are undefined
|
|
27
27
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## atMostOne() function
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Verifies that both properties are not specified.
|
|
8
8
|
|
|
9
9
|
<b>Signature:</b>
|
|
10
10
|
|
|
@@ -23,5 +23,5 @@ export declare function atMostOne(a: any, b: any): boolean;
|
|
|
23
23
|
|
|
24
24
|
boolean
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
false if a and b are both defined, true otherwise
|
|
27
27
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## Authenticator.authenticationType() method
|
|
6
6
|
|
|
7
|
-
Retrieves the authenticator's type. The returned value will be the same string that is used when configuring an instance of the authenticator with the
|
|
7
|
+
Retrieves the authenticator's type. The returned value will be the same string that is used when configuring an instance of the authenticator with the <<!-- -->service\_name<!-- -->><!-- -->\_AUTH\_TYPE configuration property (e.g. "basic", "iam", etc.). This function should be overridden in each authenticator implementation class that extends this class.
|
|
8
8
|
|
|
9
9
|
<b>Signature:</b>
|
|
10
10
|
|
|
@@ -37,5 +37,5 @@ export declare class Authenticator implements AuthenticatorInterface
|
|
|
37
37
|
| Method | Modifiers | Description |
|
|
38
38
|
| --- | --- | --- |
|
|
39
39
|
| [authenticate(requestOptions)](./ibm-cloud-sdk-core.authenticator.authenticate.md) | | Augment the request with authentication information. |
|
|
40
|
-
| [authenticationType()](./ibm-cloud-sdk-core.authenticator.authenticationtype.md) | | Retrieves the authenticator's type. The returned value will be the same string that is used when configuring an instance of the authenticator with the
|
|
40
|
+
| [authenticationType()](./ibm-cloud-sdk-core.authenticator.authenticationtype.md) | | Retrieves the authenticator's type. The returned value will be the same string that is used when configuring an instance of the authenticator with the <<!-- -->service\_name<!-- -->><!-- -->\_AUTH\_TYPE configuration property (e.g. "basic", "iam", etc.). This function should be overridden in each authenticator implementation class that extends this class. |
|
|
41
41
|
|
|
@@ -16,7 +16,7 @@ authenticate(requestOptions: AuthenticateOptions): Promise<void>;
|
|
|
16
16
|
|
|
17
17
|
| Parameter | Type | Description |
|
|
18
18
|
| --- | --- | --- |
|
|
19
|
-
| requestOptions | AuthenticateOptions | The request to
|
|
19
|
+
| requestOptions | AuthenticateOptions | The request to which authentication information is added (in the headers field). |
|
|
20
20
|
|
|
21
21
|
<b>Returns:</b>
|
|
22
22
|
|
|
@@ -16,5 +16,5 @@ constructor(userOptions: UserOptions);
|
|
|
16
16
|
|
|
17
17
|
| Parameter | Type | Description |
|
|
18
18
|
| --- | --- | --- |
|
|
19
|
-
| userOptions | [UserOptions](./ibm-cloud-sdk-core.useroptions.md) |
|
|
19
|
+
| userOptions | [UserOptions](./ibm-cloud-sdk-core.useroptions.md) | the configuration options to set on the service instance. This should be an object with the following fields: - authenticator: (required) an Object used to authenticate requests to the service. - serviceUrl: (optional) the base url to use when contacting the service. The base url may differ between IBM Cloud regions. - headers: (optional) a set of HTTP headers that should be included with every request sent to the service - disableSslVerification: (optional) a flag that indicates whether verification of the server's SSL certificate should be disabled or not. |
|
|
20
20
|
|
|
@@ -16,7 +16,7 @@ protected configureService(serviceName: string): void;
|
|
|
16
16
|
|
|
17
17
|
| Parameter | Type | Description |
|
|
18
18
|
| --- | --- | --- |
|
|
19
|
-
| serviceName | string |
|
|
19
|
+
| serviceName | string | the name of the service. This will be used to read from external configuration. |
|
|
20
20
|
|
|
21
21
|
<b>Returns:</b>
|
|
22
22
|
|
|
@@ -16,11 +16,11 @@ protected createRequest(parameters: any): Promise<any>;
|
|
|
16
16
|
|
|
17
17
|
| Parameter | Type | Description |
|
|
18
18
|
| --- | --- | --- |
|
|
19
|
-
| parameters | any | Service request options passed in by user. |
|
|
19
|
+
| parameters | any | Service request options passed in by user. This should be an object with the following fields: - options.method: the http method - options.url: the path portion of the URL to be appended to the serviceUrl - options.path: the path parameters to be inserted into the URL - options.qs: the querystring to be included in the URL - options.body: the data to be sent as the request body - options.form: an object containing the key/value pairs for a www-form-urlencoded request. - options.formData: an object containing the contents for a multipart/form-data request The following processing is performed on formData values: - string: no special processing -- the value is sent as is - object: the value is converted to a JSON string before insertion into the form body - NodeJS.ReadableStream\|Buffer\|FileWithMetadata: sent as a file, with any associated metadata - array: each element of the array is sent as a separate form part using any special processing as described above - defaultOptions.serviceUrl: the base URL of the service - defaultOptions.headers: additional HTTP headers to be sent with the request |
|
|
20
20
|
|
|
21
21
|
<b>Returns:</b>
|
|
22
22
|
|
|
23
23
|
Promise<any>
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
a Promise
|
|
26
26
|
|
|
@@ -16,7 +16,7 @@ enableRetries(retryOptions?: RetryOptions): void;
|
|
|
16
16
|
|
|
17
17
|
| Parameter | Type | Description |
|
|
18
18
|
| --- | --- | --- |
|
|
19
|
-
| retryOptions | RetryOptions | <i>(Optional)</i> configuration for retries |
|
|
19
|
+
| retryOptions | RetryOptions | <i>(Optional)</i> the configuration for retries |
|
|
20
20
|
|
|
21
21
|
<b>Returns:</b>
|
|
22
22
|
|
|
@@ -24,7 +24,7 @@ export declare class BaseService
|
|
|
24
24
|
|
|
25
25
|
| Property | Modifiers | Type | Description |
|
|
26
26
|
| --- | --- | --- | --- |
|
|
27
|
-
| [baseOptions](./ibm-cloud-sdk-core.baseservice.baseoptions.md) |
|
|
27
|
+
| [baseOptions](./ibm-cloud-sdk-core.baseservice.baseoptions.md) | <code>protected</code> | BaseServiceOptions | |
|
|
28
28
|
| [DEFAULT\_SERVICE\_NAME](./ibm-cloud-sdk-core.baseservice.default_service_name.md) | <code>static</code> | string | |
|
|
29
29
|
| [DEFAULT\_SERVICE\_URL](./ibm-cloud-sdk-core.baseservice.default_service_url.md) | <code>static</code> | string | |
|
|
30
30
|
|
|
@@ -32,8 +32,8 @@ export declare class BaseService
|
|
|
32
32
|
|
|
33
33
|
| Method | Modifiers | Description |
|
|
34
34
|
| --- | --- | --- |
|
|
35
|
-
| [configureService(serviceName)](./ibm-cloud-sdk-core.baseservice.configureservice.md) |
|
|
36
|
-
| [createRequest(parameters)](./ibm-cloud-sdk-core.baseservice.createrequest.md) |
|
|
35
|
+
| [configureService(serviceName)](./ibm-cloud-sdk-core.baseservice.configureservice.md) | <code>protected</code> | Configure the service using external configuration |
|
|
36
|
+
| [createRequest(parameters)](./ibm-cloud-sdk-core.baseservice.createrequest.md) | <code>protected</code> | Wrapper around <code>sendRequest</code> that enforces the request will be authenticated. |
|
|
37
37
|
| [disableRetries()](./ibm-cloud-sdk-core.baseservice.disableretries.md) | | Disables retries. |
|
|
38
38
|
| [enableRetries(retryOptions)](./ibm-cloud-sdk-core.baseservice.enableretries.md) | | Enable retries for unfulfilled requests. |
|
|
39
39
|
| [getAuthenticator()](./ibm-cloud-sdk-core.baseservice.getauthenticator.md) | | Get the instance of the authenticator set on the service. |
|
|
@@ -16,7 +16,7 @@ setDefaultHeaders(headers: OutgoingHttpHeaders): void;
|
|
|
16
16
|
|
|
17
17
|
| Parameter | Type | Description |
|
|
18
18
|
| --- | --- | --- |
|
|
19
|
-
| headers | OutgoingHttpHeaders |
|
|
19
|
+
| headers | OutgoingHttpHeaders | the map of headers to include in requests. |
|
|
20
20
|
|
|
21
21
|
<b>Returns:</b>
|
|
22
22
|
|
|
@@ -16,9 +16,9 @@ constructor(options: Options);
|
|
|
16
16
|
|
|
17
17
|
| Parameter | Type | Description |
|
|
18
18
|
| --- | --- | --- |
|
|
19
|
-
| options | Options | Configuration options for basic authentication. |
|
|
19
|
+
| options | Options | Configuration options for basic authentication. This should be an object containing these fields: - username: the username portion of basic authentication - password: the password portion of basic authentication |
|
|
20
20
|
|
|
21
21
|
## Exceptions
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
Error: the configuration options are not valid.
|
|
24
24
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## BasicAuthenticator.authenticate() method
|
|
6
6
|
|
|
7
|
-
Add basic authentication information to `
|
|
7
|
+
Add basic authentication information to `requestOptions`<!-- -->. The basic authentication information will be set in the Authorization property of `requestOptions.headers` in the form:
|
|
8
8
|
|
|
9
9
|
Authorization: Basic <<!-- -->encoded username and password<!-- -->>
|
|
10
10
|
|
|
@@ -27,13 +27,13 @@ export declare class BasicAuthenticator extends Authenticator
|
|
|
27
27
|
|
|
28
28
|
| Property | Modifiers | Type | Description |
|
|
29
29
|
| --- | --- | --- | --- |
|
|
30
|
-
| [authHeader](./ibm-cloud-sdk-core.basicauthenticator.authheader.md) |
|
|
31
|
-
| [requiredOptions](./ibm-cloud-sdk-core.basicauthenticator.requiredoptions.md) |
|
|
30
|
+
| [authHeader](./ibm-cloud-sdk-core.basicauthenticator.authheader.md) | <code>protected</code> | { Authorization: string; } | |
|
|
31
|
+
| [requiredOptions](./ibm-cloud-sdk-core.basicauthenticator.requiredoptions.md) | <code>protected</code> | string\[\] | |
|
|
32
32
|
|
|
33
33
|
## Methods
|
|
34
34
|
|
|
35
35
|
| Method | Modifiers | Description |
|
|
36
36
|
| --- | --- | --- |
|
|
37
|
-
| [authenticate(requestOptions)](./ibm-cloud-sdk-core.basicauthenticator.authenticate.md) | | Add basic authentication information to <code>
|
|
37
|
+
| [authenticate(requestOptions)](./ibm-cloud-sdk-core.basicauthenticator.authenticate.md) | | <p>Add basic authentication information to <code>requestOptions</code>. The basic authentication information will be set in the Authorization property of <code>requestOptions.headers</code> in the form:</p><p>Authorization: Basic <<!-- -->encoded username and password<!-- -->></p> |
|
|
38
38
|
| [authenticationType()](./ibm-cloud-sdk-core.basicauthenticator.authenticationtype.md) | | Returns the authenticator's type ('basic'). |
|
|
39
39
|
|
|
@@ -16,9 +16,9 @@ constructor(options: Options);
|
|
|
16
16
|
|
|
17
17
|
| Parameter | Type | Description |
|
|
18
18
|
| --- | --- | --- |
|
|
19
|
-
| options | Options | Configuration options for bearer authentication. |
|
|
19
|
+
| options | Options | Configuration options for bearer authentication. This should be an object containing the "bearerToken" field. |
|
|
20
20
|
|
|
21
21
|
## Exceptions
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
Error: the options.bearerToken field is not valid, or unspecified
|
|
24
24
|
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
## BearerTokenAuthenticator.authenticate() method
|
|
6
6
|
|
|
7
|
-
Add a bearer token to
|
|
7
|
+
Add a bearer token to `requestOptions`<!-- -->. The bearer token information will be set in the Authorization property of "requestOptions.headers" in the form:
|
|
8
8
|
|
|
9
|
-
Authorization: Bearer
|
|
9
|
+
Authorization: Bearer <<!-- -->bearer-token<!-- -->>
|
|
10
10
|
|
|
11
11
|
<b>Signature:</b>
|
|
12
12
|
|