ibm-cloud-sdk-core 3.2.2-beta-4 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cra/.cveignore +2 -0
- package/.secrets.baseline +542 -0
- package/Authentication.md +525 -0
- package/CHANGELOG.md +713 -0
- package/LICENSE.md +201 -0
- package/MIGRATION-V1.md +42 -0
- package/README.md +116 -0
- package/api-extractor.json +39 -0
- package/appscan-config.xml +7 -0
- package/auth/authenticators/basic-authenticator.d.ts +1 -1
- package/auth/authenticators/bearer-token-authenticator.d.ts +1 -1
- package/auth/authenticators/token-request-based-authenticator.d.ts +1 -1
- package/auth/token-managers/container-token-manager.js +1 -1
- package/auth/token-managers/jwt-token-manager.d.ts +1 -1
- package/auth/token-managers/token-manager.d.ts +1 -1
- package/auth/token-managers/vpc-instance-token-manager.js +1 -1
- package/build/docs/ibm-cloud-sdk-core.atleastone.md +27 -0
- package/build/docs/ibm-cloud-sdk-core.atmostone.md +27 -0
- package/build/docs/ibm-cloud-sdk-core.authenticator._constructor_.md +18 -0
- package/build/docs/ibm-cloud-sdk-core.authenticator.authenticate.md +28 -0
- package/build/docs/ibm-cloud-sdk-core.authenticator.authenticationtype.md +19 -0
- package/build/docs/ibm-cloud-sdk-core.authenticator.authtype_basic.md +13 -0
- package/build/docs/ibm-cloud-sdk-core.authenticator.authtype_bearertoken.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.authenticator.authtype_container.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.authenticator.authtype_cp4d.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.authenticator.authtype_iam.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.authenticator.authtype_noauth.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.authenticator.authtype_unknown.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.authenticator.authtype_vpc.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.authenticator.md +41 -0
- package/build/docs/ibm-cloud-sdk-core.authenticatorinterface.authenticate.md +24 -0
- package/build/docs/ibm-cloud-sdk-core.authenticatorinterface.authenticationtype.md +17 -0
- package/build/docs/ibm-cloud-sdk-core.authenticatorinterface.md +21 -0
- package/build/docs/ibm-cloud-sdk-core.baseservice._constructor_.md +20 -0
- package/build/docs/ibm-cloud-sdk-core.baseservice.baseoptions.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.baseservice.configureservice.md +24 -0
- package/build/docs/ibm-cloud-sdk-core.baseservice.createrequest.md +26 -0
- package/build/docs/ibm-cloud-sdk-core.baseservice.default_service_name.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.baseservice.default_service_url.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.baseservice.disableretries.md +17 -0
- package/build/docs/ibm-cloud-sdk-core.baseservice.enableretries.md +24 -0
- package/build/docs/ibm-cloud-sdk-core.baseservice.getauthenticator.md +19 -0
- package/build/docs/ibm-cloud-sdk-core.baseservice.gethttpclient.md +17 -0
- package/build/docs/ibm-cloud-sdk-core.baseservice.md +44 -0
- package/build/docs/ibm-cloud-sdk-core.baseservice.setdefaultheaders.md +24 -0
- package/build/docs/ibm-cloud-sdk-core.baseservice.setenablegzipcompression.md +24 -0
- package/build/docs/ibm-cloud-sdk-core.baseservice.setserviceurl.md +24 -0
- package/build/docs/ibm-cloud-sdk-core.basicauthenticator._constructor_.md +24 -0
- package/build/docs/ibm-cloud-sdk-core.basicauthenticator.authenticate.md +26 -0
- package/build/docs/ibm-cloud-sdk-core.basicauthenticator.authenticationtype.md +19 -0
- package/build/docs/ibm-cloud-sdk-core.basicauthenticator.authheader.md +13 -0
- package/build/docs/ibm-cloud-sdk-core.basicauthenticator.md +39 -0
- package/build/docs/ibm-cloud-sdk-core.basicauthenticator.requiredoptions.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.bearertokenauthenticator._constructor_.md +24 -0
- package/build/docs/ibm-cloud-sdk-core.bearertokenauthenticator.authenticate.md +26 -0
- package/build/docs/ibm-cloud-sdk-core.bearertokenauthenticator.authenticationtype.md +19 -0
- package/build/docs/ibm-cloud-sdk-core.bearertokenauthenticator.md +39 -0
- package/build/docs/ibm-cloud-sdk-core.bearertokenauthenticator.requiredoptions.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.bearertokenauthenticator.setbearertoken.md +24 -0
- package/build/docs/ibm-cloud-sdk-core.buildrequestfileobject.md +26 -0
- package/build/docs/ibm-cloud-sdk-core.checkcredentials.md +27 -0
- package/build/docs/ibm-cloud-sdk-core.cloudpakfordataauthenticator._constructor_.md +24 -0
- package/build/docs/ibm-cloud-sdk-core.cloudpakfordataauthenticator.authenticationtype.md +19 -0
- package/build/docs/ibm-cloud-sdk-core.cloudpakfordataauthenticator.md +38 -0
- package/build/docs/ibm-cloud-sdk-core.cloudpakfordataauthenticator.requiredoptions.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.cloudpakfordataauthenticator.tokenmanager.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.computebasicauthheader.md +27 -0
- package/build/docs/ibm-cloud-sdk-core.constructfilepath.md +22 -0
- package/build/docs/ibm-cloud-sdk-core.constructserviceurl.md +28 -0
- package/build/docs/ibm-cloud-sdk-core.containerauthenticator._constructor_.md +24 -0
- package/build/docs/ibm-cloud-sdk-core.containerauthenticator.authenticationtype.md +19 -0
- package/build/docs/ibm-cloud-sdk-core.containerauthenticator.md +40 -0
- package/build/docs/ibm-cloud-sdk-core.containerauthenticator.setcrtokenfilename.md +24 -0
- package/build/docs/ibm-cloud-sdk-core.containerauthenticator.setiamprofileid.md +24 -0
- package/build/docs/ibm-cloud-sdk-core.containerauthenticator.setiamprofilename.md +24 -0
- package/build/docs/ibm-cloud-sdk-core.containerauthenticator.tokenmanager.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.containertokenmanager._constructor_.md +20 -0
- package/build/docs/ibm-cloud-sdk-core.containertokenmanager.md +30 -0
- package/build/docs/ibm-cloud-sdk-core.containertokenmanager.requesttoken.md +19 -0
- package/build/docs/ibm-cloud-sdk-core.containertokenmanager.setcrtokenfilename.md +24 -0
- package/build/docs/ibm-cloud-sdk-core.containertokenmanager.setiamprofileid.md +24 -0
- package/build/docs/ibm-cloud-sdk-core.containertokenmanager.setiamprofilename.md +24 -0
- package/build/docs/ibm-cloud-sdk-core.contenttype.md +14 -0
- package/build/docs/ibm-cloud-sdk-core.cp4dtokenmanager._constructor_.md +20 -0
- package/build/docs/ibm-cloud-sdk-core.cp4dtokenmanager.md +35 -0
- package/build/docs/ibm-cloud-sdk-core.cp4dtokenmanager.requesttoken.md +15 -0
- package/build/docs/ibm-cloud-sdk-core.cp4dtokenmanager.requiredoptions.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.fileexistsatpath.md +22 -0
- package/build/docs/ibm-cloud-sdk-core.fileobject.md +27 -0
- package/build/docs/ibm-cloud-sdk-core.fileobject.options.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.fileobject.value.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.fileoptions.contenttype.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.fileoptions.filename.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.fileoptions.md +19 -0
- package/build/docs/ibm-cloud-sdk-core.filestream.md +19 -0
- package/build/docs/ibm-cloud-sdk-core.filestream.path.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.filewithmetadata.contenttype.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.filewithmetadata.data.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.filewithmetadata.filename.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.filewithmetadata.md +20 -0
- package/build/docs/ibm-cloud-sdk-core.getauthenticatorfromenvironment.md +26 -0
- package/build/docs/ibm-cloud-sdk-core.getcontenttype.md +26 -0
- package/build/docs/ibm-cloud-sdk-core.getcurrenttime.md +19 -0
- package/build/docs/ibm-cloud-sdk-core.getformat.md +29 -0
- package/build/docs/ibm-cloud-sdk-core.getmissingparams.md +29 -0
- package/build/docs/ibm-cloud-sdk-core.getnewlogger.md +30 -0
- package/build/docs/ibm-cloud-sdk-core.getqueryparam.md +31 -0
- package/build/docs/ibm-cloud-sdk-core.iamauthenticator._constructor_.md +24 -0
- package/build/docs/ibm-cloud-sdk-core.iamauthenticator.authenticationtype.md +19 -0
- package/build/docs/ibm-cloud-sdk-core.iamauthenticator.md +38 -0
- package/build/docs/ibm-cloud-sdk-core.iamauthenticator.requiredoptions.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.iamauthenticator.tokenmanager.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator._constructor_.md +24 -0
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.clientid.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.clientsecret.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.getrefreshtoken.md +19 -0
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.md +38 -0
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.scope.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.setclientidandsecret.md +25 -0
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.setscope.md +24 -0
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.tokenmanager.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager._constructor_.md +20 -0
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.formdata.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.getrefreshtoken.md +19 -0
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.md +38 -0
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.refreshtoken.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.requesttoken.md +19 -0
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.savetokeninfo.md +26 -0
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.setclientidandsecret.md +27 -0
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.setscope.md +26 -0
- package/build/docs/ibm-cloud-sdk-core.iamrequestoptions.clientid.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.iamrequestoptions.clientsecret.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.iamrequestoptions.md +23 -0
- package/build/docs/ibm-cloud-sdk-core.iamrequestoptions.scope.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.iamtokenmanager._constructor_.md +20 -0
- package/build/docs/ibm-cloud-sdk-core.iamtokenmanager.md +27 -0
- package/build/docs/ibm-cloud-sdk-core.iamtokenmanager.requiredoptions.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.isemptyobject.md +22 -0
- package/build/docs/ibm-cloud-sdk-core.isfiledata.md +22 -0
- package/build/docs/ibm-cloud-sdk-core.isfilewithmetadata.md +22 -0
- package/build/docs/ibm-cloud-sdk-core.ishtml.md +26 -0
- package/build/docs/ibm-cloud-sdk-core.jwttokenmanager._constructor_.md +20 -0
- package/build/docs/ibm-cloud-sdk-core.jwttokenmanager.md +35 -0
- package/build/docs/ibm-cloud-sdk-core.jwttokenmanager.requesttoken.md +19 -0
- package/build/docs/ibm-cloud-sdk-core.jwttokenmanager.savetokeninfo.md +26 -0
- package/build/docs/ibm-cloud-sdk-core.jwttokenmanager.tokeninfo.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.jwttokenmanager.tokenname.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.jwttokenmanageroptions.md +15 -0
- package/build/docs/ibm-cloud-sdk-core.md +96 -0
- package/build/docs/ibm-cloud-sdk-core.noauthauthenticator.authenticate.md +22 -0
- package/build/docs/ibm-cloud-sdk-core.noauthauthenticator.authenticationtype.md +19 -0
- package/build/docs/ibm-cloud-sdk-core.noauthauthenticator.md +22 -0
- package/build/docs/ibm-cloud-sdk-core.onlyone.md +27 -0
- package/build/docs/ibm-cloud-sdk-core.qs.md +21 -0
- package/build/docs/ibm-cloud-sdk-core.readcredentialsfile.md +17 -0
- package/build/docs/ibm-cloud-sdk-core.readcrtokenfile.md +22 -0
- package/build/docs/ibm-cloud-sdk-core.readexternalsources.md +26 -0
- package/build/docs/ibm-cloud-sdk-core.removesuffix.md +27 -0
- package/build/docs/ibm-cloud-sdk-core.sdklogger.debug.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.sdklogger.error.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.sdklogger.info.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.sdklogger.md +22 -0
- package/build/docs/ibm-cloud-sdk-core.sdklogger.verbose.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.sdklogger.warn.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.streamtopromise.md +24 -0
- package/build/docs/ibm-cloud-sdk-core.striptrailingslash.md +24 -0
- package/build/docs/ibm-cloud-sdk-core.tokenmanager._constructor_.md +20 -0
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.accesstoken.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.disablesslverification.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.expiretime.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.gettoken.md +17 -0
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.headers.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.md +43 -0
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.pacedrequesttoken.md +19 -0
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.refreshtime.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.requesttoken.md +19 -0
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.requestwrapperinstance.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.savetokeninfo.md +26 -0
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.setdisablesslverification.md +26 -0
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.setheaders.md +26 -0
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.url.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.tokenmanageroptions.md +18 -0
- package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator._constructor_.md +20 -0
- package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.authenticate.md +26 -0
- package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.disablesslverification.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.headers.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.md +42 -0
- package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.setdisablesslverification.md +24 -0
- package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.setheaders.md +24 -0
- package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.tokenmanager.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.url.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.tolowerkeys.md +26 -0
- package/build/docs/ibm-cloud-sdk-core.unittestutils.checkforsuccessfulexecution.md +26 -0
- package/build/docs/ibm-cloud-sdk-core.unittestutils.checkmediaheaders.md +28 -0
- package/build/docs/ibm-cloud-sdk-core.unittestutils.checkurlandmethod.md +28 -0
- package/build/docs/ibm-cloud-sdk-core.unittestutils.checkuserheader.md +28 -0
- package/build/docs/ibm-cloud-sdk-core.unittestutils.expecttobepromise.md +26 -0
- package/build/docs/ibm-cloud-sdk-core.unittestutils.getoptions.md +26 -0
- package/build/docs/ibm-cloud-sdk-core.unittestutils.md +17 -0
- package/build/docs/ibm-cloud-sdk-core.useroptions.authenticator.md +13 -0
- package/build/docs/ibm-cloud-sdk-core.useroptions.disablesslverification.md +13 -0
- package/build/docs/ibm-cloud-sdk-core.useroptions.headers.md +13 -0
- package/build/docs/ibm-cloud-sdk-core.useroptions.jar.md +13 -0
- package/build/docs/ibm-cloud-sdk-core.useroptions.md +26 -0
- package/build/docs/ibm-cloud-sdk-core.useroptions.serviceurl.md +13 -0
- package/build/docs/ibm-cloud-sdk-core.useroptions.url.md +13 -0
- package/build/docs/ibm-cloud-sdk-core.useroptions.version.md +13 -0
- package/build/docs/ibm-cloud-sdk-core.validateinput.md +23 -0
- package/build/docs/ibm-cloud-sdk-core.validateparams.md +30 -0
- package/build/docs/ibm-cloud-sdk-core.vpcinstanceauthenticator._constructor_.md +20 -0
- package/build/docs/ibm-cloud-sdk-core.vpcinstanceauthenticator.authenticationtype.md +19 -0
- package/build/docs/ibm-cloud-sdk-core.vpcinstanceauthenticator.md +39 -0
- package/build/docs/ibm-cloud-sdk-core.vpcinstanceauthenticator.setiamprofilecrn.md +24 -0
- package/build/docs/ibm-cloud-sdk-core.vpcinstanceauthenticator.setiamprofileid.md +24 -0
- package/build/docs/ibm-cloud-sdk-core.vpcinstanceauthenticator.tokenmanager.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.vpcinstancetokenmanager._constructor_.md +20 -0
- package/build/docs/ibm-cloud-sdk-core.vpcinstancetokenmanager.md +29 -0
- package/build/docs/ibm-cloud-sdk-core.vpcinstancetokenmanager.requesttoken.md +15 -0
- package/build/docs/ibm-cloud-sdk-core.vpcinstancetokenmanager.setiamprofilecrn.md +24 -0
- package/build/docs/ibm-cloud-sdk-core.vpcinstancetokenmanager.setiamprofileid.md +24 -0
- package/build/docs/index.md +12 -0
- package/docs/ibm-cloud-sdk-core.api.json +2 -2
- package/es/auth/authenticators/basic-authenticator.d.ts +1 -1
- package/es/auth/authenticators/bearer-token-authenticator.d.ts +1 -1
- package/es/auth/authenticators/token-request-based-authenticator.d.ts +1 -1
- package/es/auth/token-managers/jwt-token-manager.d.ts +1 -1
- package/es/auth/token-managers/token-manager.d.ts +1 -1
- package/es/lib/cookie-support.js +3 -4
- package/es/lib/request-wrapper.js +4 -2
- package/es/tsdoc-metadata.json +11 -0
- package/etc/ibm-cloud-sdk-core.api.md +483 -0
- package/lib/cookie-support.js +24 -24
- package/lib/helper.js +1 -1
- package/lib/request-wrapper.js +6 -6
- package/package.json +3 -37
- package/temp/ibm-cloud-sdk-core.api.json +7571 -0
- package/temp/ibm-cloud-sdk-core.api.md +483 -0
- package/tsconfig-es6.json +9 -0
|
@@ -0,0 +1,525 @@
|
|
|
1
|
+
# Authentication
|
|
2
|
+
The node-sdk-core project supports the following types of authentication:
|
|
3
|
+
- Basic Authentication
|
|
4
|
+
- Bearer Token Authentication
|
|
5
|
+
- Identity and Access Management (IAM) Authentication
|
|
6
|
+
- Container Authentication
|
|
7
|
+
- VPC Instance Authentication
|
|
8
|
+
- Cloud Pak for Data Authentication
|
|
9
|
+
- No Authentication
|
|
10
|
+
|
|
11
|
+
The SDK user configures the appropriate type of authentication for use with service instances.
|
|
12
|
+
The authentication types that are appropriate for a particular service may vary from service to service,
|
|
13
|
+
so it is important for the SDK user to consult with the appropriate service documentation to understand
|
|
14
|
+
which authentication types are supported for that service.
|
|
15
|
+
|
|
16
|
+
The node-sdk-core allows an authenticator to be specified in one of two ways:
|
|
17
|
+
1. programmatically - the SDK user invokes the appropriate function(s) to create an instance of the
|
|
18
|
+
desired authenticator and then passes the authenticator instance when constructing an instance of the service.
|
|
19
|
+
2. configuration - the SDK user provides external configuration information (in the form of environment variables
|
|
20
|
+
or a credentials file) to indicate the type of authenticator, along with the configuration of the necessary properties
|
|
21
|
+
for that authenticator. The SDK user then invokes the configuration-based authenticator factory to construct an instance
|
|
22
|
+
of the authenticator that is described in the external configuration information.
|
|
23
|
+
|
|
24
|
+
The sections below will provide detailed information for each authenticator
|
|
25
|
+
which will include the following:
|
|
26
|
+
- A description of the authenticator
|
|
27
|
+
- The properties associated with the authenticator
|
|
28
|
+
- An example of how to construct the authenticator programmatically
|
|
29
|
+
- An example of how to configure the authenticator through the use of external
|
|
30
|
+
configuration information. The configuration examples below will use
|
|
31
|
+
environment variables, although the same properties could be specified in a
|
|
32
|
+
credentials file instead.
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## Basic Authentication
|
|
36
|
+
The `BasicAuthenticator` is used to add Basic Authentication information to
|
|
37
|
+
each outbound request in the `Authorization` header in the form:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
Authorization: Basic <encoded username and password>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Properties
|
|
44
|
+
|
|
45
|
+
- username: (required) the basic auth username
|
|
46
|
+
|
|
47
|
+
- password: (required) the basic auth password
|
|
48
|
+
|
|
49
|
+
### Programming example
|
|
50
|
+
```js
|
|
51
|
+
const { BasicAuthenticator } = require('ibm-cloud-sdk-core');
|
|
52
|
+
const ExampleServiceV1 = require('<sdk-package-name>/example-service/v1');
|
|
53
|
+
|
|
54
|
+
const authenticator = new BasicAuthenticator({
|
|
55
|
+
username: 'myuser',
|
|
56
|
+
password: 'mypassword',
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const options = {
|
|
60
|
+
authenticator,
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const service = new ExampleServiceV1(options);
|
|
64
|
+
|
|
65
|
+
// 'service' can now be used to invoke operations.
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Configuration example
|
|
69
|
+
External configuration:
|
|
70
|
+
```
|
|
71
|
+
export EXAMPLE_SERVICE_AUTH_TYPE=basic
|
|
72
|
+
export EXAMPLE_SERVICE_USERNAME=myuser
|
|
73
|
+
export EXAMPLE_SERVICE_PASSWORD=mypassword
|
|
74
|
+
```
|
|
75
|
+
Application code:
|
|
76
|
+
```js
|
|
77
|
+
const ExampleServiceV1 = require('<sdk-package-name>/example-service/v1');
|
|
78
|
+
|
|
79
|
+
const options = {
|
|
80
|
+
serviceName: 'example_service',
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const service = ExampleServiceV1.newInstance(options);
|
|
84
|
+
|
|
85
|
+
// 'service' can now be used to invoke operations.
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
## Bearer Token Authentication
|
|
90
|
+
The `BearerTokenAuthenticator` will add a user-supplied bearer token to
|
|
91
|
+
each outbound request in the `Authorization` header in the form:
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
Authorization: Bearer <bearer-token>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Properties
|
|
98
|
+
|
|
99
|
+
- bearerToken: (required) the bearer token value
|
|
100
|
+
|
|
101
|
+
### Programming example
|
|
102
|
+
```js
|
|
103
|
+
const { BearerTokenAuthenticator } = require('ibm-cloud-sdk-core');
|
|
104
|
+
const ExampleServiceV1 = require('<sdk-package-name>/example-service/v1');
|
|
105
|
+
|
|
106
|
+
const bearerToken = // ... obtain bearer token value ...
|
|
107
|
+
const authenticator = new BearerTokenAuthenticator({
|
|
108
|
+
bearerToken: bearerToken,
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
const options = {
|
|
112
|
+
authenticator,
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const service = new ExampleServiceV1(options);
|
|
116
|
+
|
|
117
|
+
// 'service' can now be used to invoke operations.
|
|
118
|
+
...
|
|
119
|
+
// Later, if your bearer token value expires, you can set a new one like this:
|
|
120
|
+
newToken = // ... obtain new bearer token value
|
|
121
|
+
authenticator.bearerToken = newToken;
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Configuration example
|
|
125
|
+
External configuration:
|
|
126
|
+
```
|
|
127
|
+
export EXAMPLE_SERVICE_AUTH_TYPE=bearertoken
|
|
128
|
+
export EXAMPLE_SERVICE_BEARER_TOKEN=<the bearer token value>
|
|
129
|
+
```
|
|
130
|
+
Application code:
|
|
131
|
+
```js
|
|
132
|
+
const ExampleServiceV1 = require('<sdk-package-name>/example-service/v1');
|
|
133
|
+
|
|
134
|
+
const options = {
|
|
135
|
+
serviceName: 'example_service',
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const service = ExampleServiceV1.newInstance(options);
|
|
139
|
+
|
|
140
|
+
// 'service' can now be used to invoke operations.
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Note that the use of external configuration is not as useful with the `BearerTokenAuthenticator` as it
|
|
144
|
+
is for other authenticator types because bearer tokens typically need to be obtained and refreshed
|
|
145
|
+
programmatically since they normally have a relatively short lifespan before they expire. This
|
|
146
|
+
authenticator type is intended for situations in which the application will be managing the bearer
|
|
147
|
+
token itself in terms of initial acquisition and refreshing as needed.
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
## Identity and Access Management Authentication (IAM)
|
|
151
|
+
The `IamAuthenticator` will accept a user-supplied api key and will perform
|
|
152
|
+
the necessary interactions with the IAM token service to obtain a suitable
|
|
153
|
+
bearer token for the specified api key. The authenticator will also obtain
|
|
154
|
+
a new bearer token when the current token expires. The bearer token is
|
|
155
|
+
then added to each outbound request in the `Authorization` header in the
|
|
156
|
+
form:
|
|
157
|
+
```
|
|
158
|
+
Authorization: Bearer <bearer-token>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Properties
|
|
162
|
+
|
|
163
|
+
- apikey: (required) the IAM api key
|
|
164
|
+
|
|
165
|
+
- url: (optional) The base endpoint URL of the IAM token service.
|
|
166
|
+
The default value of this property is the "prod" IAM token service endpoint
|
|
167
|
+
(`https://iam.cloud.ibm.com`).
|
|
168
|
+
Make sure that you use an IAM token service endpoint that is appropriate for the
|
|
169
|
+
location of the service being used by your application.
|
|
170
|
+
For example, if you are using an instance of a service in the "production" environment
|
|
171
|
+
(e.g. `https://resource-controller.cloud.ibm.com`),
|
|
172
|
+
then the default "prod" IAM token service endpoint should suffice.
|
|
173
|
+
However, if your application is using an instance of a service in the "staging" environment
|
|
174
|
+
(e.g. `https://resource-controller.test.cloud.ibm.com`),
|
|
175
|
+
then you would also need to configure the authenticator to use the IAM token service "staging"
|
|
176
|
+
endpoint as well (`https://iam.test.cloud.ibm.com`).
|
|
177
|
+
|
|
178
|
+
- clientId/clientSecret: (optional) The `clientId` and `clientSecret` fields are used to form a
|
|
179
|
+
"basic auth" Authorization header for interactions with the IAM token server. If neither field
|
|
180
|
+
is specified, then no Authorization header will be sent with token server requests. These fields
|
|
181
|
+
are optional, but must be specified together.
|
|
182
|
+
|
|
183
|
+
- scope: (optional) the scope to be associated with the IAM access token.
|
|
184
|
+
If not specified, then no scope wil be associated with the access token.
|
|
185
|
+
|
|
186
|
+
- disableSslVerification: (optional) A flag that indicates whether verificaton of the server's SSL
|
|
187
|
+
certificate should be disabled or not. The default value is `false`.
|
|
188
|
+
|
|
189
|
+
- headers: (optional) A set of key/value pairs that will be sent as HTTP headers in requests
|
|
190
|
+
made to the IAM token service.
|
|
191
|
+
|
|
192
|
+
### Programming example
|
|
193
|
+
```js
|
|
194
|
+
const { IamAuthenticator } = require('ibm-cloud-sdk-core');
|
|
195
|
+
const ExampleServiceV1 = require('<sdk-package-name>/example-service/v1');
|
|
196
|
+
|
|
197
|
+
const authenticator = new IamAuthenticator({
|
|
198
|
+
apikey: 'myapikey',
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
const options = {
|
|
202
|
+
authenticator,
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
const service = new ExampleServiceV1(options);
|
|
206
|
+
|
|
207
|
+
// 'service' can now be used to invoke operations.
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Configuration example
|
|
211
|
+
External configuration:
|
|
212
|
+
```
|
|
213
|
+
export EXAMPLE_SERVICE_AUTH_TYPE=iam
|
|
214
|
+
export EXAMPLE_SERVICE_APIKEY=myapikey
|
|
215
|
+
```
|
|
216
|
+
Application code:
|
|
217
|
+
```js
|
|
218
|
+
const ExampleServiceV1 = require('<sdk-package-name>/example-service/v1');
|
|
219
|
+
|
|
220
|
+
const options = {
|
|
221
|
+
serviceName: 'example_service',
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
const service = ExampleServiceV1.newInstance(options);
|
|
225
|
+
|
|
226
|
+
// 'service' can now be used to invoke operations.
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
## Container Authentication
|
|
231
|
+
The `ContainerAuthenticator` is intended to be used by application code
|
|
232
|
+
running inside a compute resource managed by the IBM Kubernetes Service (IKS)
|
|
233
|
+
in which a secure compute resource token (CR token) has been stored in a file
|
|
234
|
+
within the compute resource's local file system.
|
|
235
|
+
The CR token is similar to an IAM apikey except that it is managed automatically by
|
|
236
|
+
the compute resource provider (IKS).
|
|
237
|
+
This allows the application developer to:
|
|
238
|
+
- avoid storing credentials in application code, configuraton files or a password vault
|
|
239
|
+
- avoid managing or rotating credentials
|
|
240
|
+
|
|
241
|
+
The `ContainerAuthenticator` will retrieve the CR token from
|
|
242
|
+
the compute resource in which the application is running, and will then perform
|
|
243
|
+
the necessary interactions with the IAM token service to obtain an IAM access token
|
|
244
|
+
using the IAM "get token" operation with grant-type `cr-token`.
|
|
245
|
+
The authenticator will repeat these steps to obtain a new IAM access token when the
|
|
246
|
+
current access token expires.
|
|
247
|
+
The IAM access token is added to each outbound request in the `Authorization` header in the form:
|
|
248
|
+
```
|
|
249
|
+
Authorization: Bearer <IAM-access-token>
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Properties
|
|
253
|
+
|
|
254
|
+
- crTokenFilename: (optional) the name of the file containing the injected CR token value.
|
|
255
|
+
If not specified, then `/var/run/secrets/tokens/vault-token` is used as the default value.
|
|
256
|
+
The application must have `read` permissions on the file containing the CR token value.
|
|
257
|
+
|
|
258
|
+
- iamProfileName: (optional) the name of the linked trusted IAM profile to be used when obtaining the
|
|
259
|
+
IAM access token (a CR token might map to multiple IAM profiles).
|
|
260
|
+
One of `iamProfileName` or `iamProfileId` must be specified.
|
|
261
|
+
|
|
262
|
+
- iamProfileId: (optional) the id of the linked trusted IAM profile to be used when obtaining the
|
|
263
|
+
IAM access token (a CR token might map to multiple IAM profiles).
|
|
264
|
+
One of `iamProfileName` or `iamProfileId` must be specified.
|
|
265
|
+
|
|
266
|
+
- url: (optional) The base endpoint URL of the IAM token service.
|
|
267
|
+
The default value of this property is the "prod" IAM token service endpoint
|
|
268
|
+
(`https://iam.cloud.ibm.com`).
|
|
269
|
+
Make sure that you use an IAM token service endpoint that is appropriate for the
|
|
270
|
+
location of the service being used by your application.
|
|
271
|
+
For example, if you are using an instance of a service in the "production" environment
|
|
272
|
+
(e.g. `https://resource-controller.cloud.ibm.com`),
|
|
273
|
+
then the default "prod" IAM token service endpoint should suffice.
|
|
274
|
+
However, if your application is using an instance of a service in the "staging" environment
|
|
275
|
+
(e.g. `https://resource-controller.test.cloud.ibm.com`),
|
|
276
|
+
then you would also need to configure the authenticator to use the IAM token service "staging"
|
|
277
|
+
endpoint as well (`https://iam.test.cloud.ibm.com`).
|
|
278
|
+
|
|
279
|
+
- clientId/clientSecret: (optional) The `clientId` and `clientSecret` fields are used to form a
|
|
280
|
+
"basic auth" Authorization header for interactions with the IAM token service. If neither field
|
|
281
|
+
is specified, then no Authorization header will be sent with token server requests. These fields
|
|
282
|
+
are optional, but must be specified together.
|
|
283
|
+
|
|
284
|
+
- scope: (optional) the scope to be associated with the IAM access token.
|
|
285
|
+
If not specified, then no scope will be associated with the access token.
|
|
286
|
+
|
|
287
|
+
- disableSslVerification: (optional) A flag that indicates whether verificaton of the server's SSL
|
|
288
|
+
certificate should be disabled or not. The default value is `false`.
|
|
289
|
+
|
|
290
|
+
- headers: (optional) A set of key/value pairs that will be sent as HTTP headers in requests
|
|
291
|
+
made to the IAM token service.
|
|
292
|
+
|
|
293
|
+
- crTokenFilename: (optional) The name of the file containing the injected CR token value.
|
|
294
|
+
If not specified, then `/var/run/secrets/tokens/vault-token` is used as the default value.
|
|
295
|
+
The application must have `read` permissions on the file containing the CR token value.
|
|
296
|
+
|
|
297
|
+
### Programming example
|
|
298
|
+
```js
|
|
299
|
+
const { ContainerAuthenticator } = require('ibm-cloud-sdk-core');
|
|
300
|
+
const ExampleServiceV1 = require('<sdk-package-name>/example-service/v1');
|
|
301
|
+
|
|
302
|
+
const authenticator = new ContainerAuthenticator({
|
|
303
|
+
iamProfileName: 'iam-user123',
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
const options = {
|
|
307
|
+
authenticator,
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
const service = new ExampleServiceV1(options);
|
|
311
|
+
|
|
312
|
+
// 'service' can now be used to invoke operations.
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### Configuration example
|
|
316
|
+
External configuration:
|
|
317
|
+
```
|
|
318
|
+
export EXAMPLE_SERVICE_AUTH_TYPE=container
|
|
319
|
+
export EXAMPLE_SERVICE_IAM_PROFILE_NAME=iam-user123
|
|
320
|
+
```
|
|
321
|
+
Application code:
|
|
322
|
+
```js
|
|
323
|
+
const ExampleServiceV1 = require('<sdk-package-name>/example-service/v1');
|
|
324
|
+
|
|
325
|
+
const options = {
|
|
326
|
+
serviceName: 'example_service',
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
const service = ExampleServiceV1.newInstance(options);
|
|
330
|
+
|
|
331
|
+
// 'service' can now be used to invoke operations.
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
## VPC Instance Authentication
|
|
336
|
+
The `VpcInstanceAuthenticator` is intended to be used by application code
|
|
337
|
+
running inside a VPC-managed compute resource (virtual server instance) that has been configured
|
|
338
|
+
to use the "compute resource identity" feature.
|
|
339
|
+
The compute resource identity feature allows you to assign a trusted IAM profile to the compute resource as its "identity".
|
|
340
|
+
This, in turn, allows applications running within the compute resource to take on this identity when interacting with
|
|
341
|
+
IAM-secured IBM Cloud services.
|
|
342
|
+
This results in a simplified security model that allows the application developer to:
|
|
343
|
+
- avoid storing credentials in application code, configuraton files or a password vault
|
|
344
|
+
- avoid managing or rotating credentials
|
|
345
|
+
|
|
346
|
+
The `VpcInstanceAuthenticator` will invoke the appropriate operations on the compute resource's locally-available
|
|
347
|
+
VPC Instance Metadata Service to (1) retrieve an instance identity token
|
|
348
|
+
and then (2) exchange that instance identity token for an IAM access token.
|
|
349
|
+
The authenticator will repeat these steps to obtain a new IAM access token whenever the current access token expires.
|
|
350
|
+
The IAM access token is added to each outbound request in the `Authorization` header in the form:
|
|
351
|
+
```
|
|
352
|
+
Authorization: Bearer <IAM-access-token>
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### Properties
|
|
356
|
+
|
|
357
|
+
- iamProfileCrn: (optional) the crn of the linked trusted IAM profile to be used when obtaining the IAM access token.
|
|
358
|
+
|
|
359
|
+
- iamProfileId: (optional) the id of the linked trusted IAM profile to be used when obtaining the IAM access token.
|
|
360
|
+
|
|
361
|
+
- url: (optional) The VPC Instance Metadata Service's base URL.
|
|
362
|
+
The default value of this property is `http://169.254.169.254`, and should not need to be specified in normal situations.
|
|
363
|
+
|
|
364
|
+
Usage Notes:
|
|
365
|
+
1. At most one of `iamProfileCrn` or `iamProfileId` may be specified. The specified value must map
|
|
366
|
+
to a trusted IAM profile that has been linked to the compute resource (virtual server instance).
|
|
367
|
+
|
|
368
|
+
2. If both `iamProfileCrn` and `iamProfileId` are specified, then an error occurs.
|
|
369
|
+
|
|
370
|
+
3. If neither `iamProfileCrn` nor `iamProfileId` are specified, then the default trusted profile linked to the
|
|
371
|
+
compute resource will be used to perform the IAM token exchange.
|
|
372
|
+
If no default trusted profile is defined for the compute resource, then an error occurs.
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
### Programming example
|
|
376
|
+
```js
|
|
377
|
+
const { VpcInstanceAuthenticator } = require('ibm-cloud-sdk-core');
|
|
378
|
+
const ExampleServiceV1 = require('<sdk-package-name>/example-service/v1');
|
|
379
|
+
|
|
380
|
+
const authenticator = new VpcInstanceAuthenticator({
|
|
381
|
+
iamProfileCrn: 'crn:iam-profile-123',
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
const options = {
|
|
385
|
+
authenticator,
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
const service = new ExampleServiceV1(options);
|
|
389
|
+
|
|
390
|
+
// 'service' can now be used to invoke operations.
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
### Configuration example
|
|
394
|
+
External configuration:
|
|
395
|
+
```
|
|
396
|
+
export EXAMPLE_SERVICE_AUTH_TYPE=vpc
|
|
397
|
+
export EXAMPLE_SERVICE_IAM_PROFILE_CRN=crn:iam-profile-123
|
|
398
|
+
```
|
|
399
|
+
Application code:
|
|
400
|
+
```js
|
|
401
|
+
const ExampleServiceV1 = require('<sdk-package-name>/example-service/v1');
|
|
402
|
+
|
|
403
|
+
const options = {
|
|
404
|
+
serviceName: 'example_service',
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
const service = ExampleServiceV1.newInstance(options);
|
|
408
|
+
|
|
409
|
+
// 'service' can now be used to invoke operations.
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
## Cloud Pak for Data Authentication
|
|
414
|
+
The `CloudPakForDataAuthenticator` will accept a user-supplied username value, along with either a
|
|
415
|
+
password or apikey, and will
|
|
416
|
+
perform the necessary interactions with the Cloud Pak for Data token service to obtain a suitable
|
|
417
|
+
bearer token. The authenticator will also obtain a new bearer token when the current token expires.
|
|
418
|
+
The bearer token is then added to each outbound request in the `Authorization` header in the
|
|
419
|
+
form:
|
|
420
|
+
```
|
|
421
|
+
Authorization: Bearer <bearer-token>
|
|
422
|
+
```
|
|
423
|
+
### Properties
|
|
424
|
+
|
|
425
|
+
- username: (required) the username used to obtain a bearer token.
|
|
426
|
+
|
|
427
|
+
- password: (required if apikey is not specified) the user's password used to obtain a bearer token.
|
|
428
|
+
Exactly one of password or apikey should be specified.
|
|
429
|
+
|
|
430
|
+
- apikey: (required if password is not specified) the user's apikey used to obtain a bearer token.
|
|
431
|
+
Exactly one of password or apikey should be specified.
|
|
432
|
+
|
|
433
|
+
- url: (required) The URL representing the Cloud Pak for Data token service endpoint's base URL string.
|
|
434
|
+
This value should not include the `/v1/authorize` path portion.
|
|
435
|
+
|
|
436
|
+
- disableSslVerification: (optional) A flag that indicates whether verificaton of the server's SSL
|
|
437
|
+
certificate should be disabled or not. The default value is `false`.
|
|
438
|
+
|
|
439
|
+
- headers: (optional) A set of key/value pairs that will be sent as HTTP headers in requests
|
|
440
|
+
made to the Cloud Pak for Data token service.
|
|
441
|
+
|
|
442
|
+
### Programming examples
|
|
443
|
+
```js
|
|
444
|
+
const { CloudPakForDataAuthenticator } = require('ibm-cloud-sdk-core');
|
|
445
|
+
const ExampleServiceV1 = require('<sdk-package-name>/example-service/v1');
|
|
446
|
+
|
|
447
|
+
const authenticator = new CloudPakForDataAuthenticator({
|
|
448
|
+
username: 'myuser',
|
|
449
|
+
apikey: 'myapikey',
|
|
450
|
+
url: 'https://mycp4dhost.com',
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
const options = {
|
|
454
|
+
authenticator,
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
const service = new ExampleServiceV1(options);
|
|
458
|
+
|
|
459
|
+
// 'service' can now be used to invoke operations.
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
### Configuration example
|
|
463
|
+
External configuration:
|
|
464
|
+
```
|
|
465
|
+
# Configure "example_service" with username/apikey.
|
|
466
|
+
export EXAMPLE_SERVICE_AUTH_TYPE=cp4d
|
|
467
|
+
export EXAMPLE_SERVICE_USERNAME=myuser
|
|
468
|
+
export EXAMPLE_SERVICE_APIKEY=myapikey
|
|
469
|
+
export EXAMPLE_SERVICE_URL=https://mycp4dhost.com
|
|
470
|
+
```
|
|
471
|
+
Application code:
|
|
472
|
+
```js
|
|
473
|
+
const ExampleServiceV1 = require('<sdk-package-name>/example-service/v1');
|
|
474
|
+
|
|
475
|
+
const options = {
|
|
476
|
+
serviceName: 'example_service',
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
const service = ExampleServiceV1.newInstance(options);
|
|
480
|
+
|
|
481
|
+
// 'service' can now be used to invoke operations.
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
## No Auth Authentication
|
|
486
|
+
The `NoAuthAuthenticator` is a placeholder authenticator which performs no actual authentication function.
|
|
487
|
+
It can be used in situations where authentication needs to be bypassed, perhaps while developing
|
|
488
|
+
or debugging an application or service.
|
|
489
|
+
|
|
490
|
+
### Properties
|
|
491
|
+
None
|
|
492
|
+
|
|
493
|
+
### Programming example
|
|
494
|
+
```js
|
|
495
|
+
const { NoAuthAuthenticator } = require('ibm-cloud-sdk-core');
|
|
496
|
+
const ExampleServiceV1 = require('<sdk-package-name>/example-service/v1');
|
|
497
|
+
|
|
498
|
+
const authenticator = new NoAuthAuthenticator();
|
|
499
|
+
|
|
500
|
+
const options = {
|
|
501
|
+
authenticator,
|
|
502
|
+
};
|
|
503
|
+
|
|
504
|
+
const service = new ExampleServiceV1(options);
|
|
505
|
+
|
|
506
|
+
// 'service' can now be used to invoke operations.
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
### Configuration example
|
|
510
|
+
External configuration:
|
|
511
|
+
```
|
|
512
|
+
export EXAMPLE_SERVICE_AUTH_TYPE=noauth
|
|
513
|
+
```
|
|
514
|
+
Application code:
|
|
515
|
+
```js
|
|
516
|
+
const ExampleServiceV1 = require('<sdk-package-name>/example-service/v1');
|
|
517
|
+
|
|
518
|
+
const options = {
|
|
519
|
+
serviceName: 'example_service',
|
|
520
|
+
};
|
|
521
|
+
|
|
522
|
+
const service = ExampleServiceV1.newInstance(options);
|
|
523
|
+
|
|
524
|
+
// 'service' can now be used to invoke operations.
|
|
525
|
+
```
|