ibm-cloud-sdk-core 4.1.5 → 4.2.1
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 +57 -9
- package/Authentication.md +73 -0
- package/CHANGELOG.md +14 -0
- package/auth/authenticators/authenticator.d.ts +2 -1
- package/auth/authenticators/authenticator.js +1 -0
- package/auth/authenticators/index.d.ts +2 -0
- package/auth/authenticators/index.js +3 -1
- package/auth/authenticators/mcsp-authenticator.d.ts +57 -0
- package/auth/authenticators/mcsp-authenticator.js +82 -0
- package/auth/token-managers/index.d.ts +5 -2
- package/auth/token-managers/index.js +7 -3
- package/auth/token-managers/mcsp-token-manager.d.ts +59 -0
- package/auth/token-managers/mcsp-token-manager.js +94 -0
- package/auth/utils/get-authenticator-from-environment.js +3 -0
- package/build/docs/ibm-cloud-sdk-core.authenticator.authtype_mcsp.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.authenticator.md +1 -0
- package/build/docs/ibm-cloud-sdk-core.mcspauthenticator._constructor_.md +24 -0
- package/build/docs/ibm-cloud-sdk-core.mcspauthenticator.authenticationtype.md +19 -0
- package/build/docs/ibm-cloud-sdk-core.mcspauthenticator.md +34 -0
- package/build/docs/ibm-cloud-sdk-core.mcspauthenticator.requiredoptions.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.mcspauthenticator.tokenmanager.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.mcsptokenmanager._constructor_.md +24 -0
- package/build/docs/ibm-cloud-sdk-core.mcsptokenmanager.md +35 -0
- package/build/docs/ibm-cloud-sdk-core.mcsptokenmanager.requesttoken.md +15 -0
- package/build/docs/ibm-cloud-sdk-core.mcsptokenmanager.requiredoptions.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.md +2 -0
- package/docs/ibm-cloud-sdk-core.api.json +319 -1
- package/es/auth/authenticators/authenticator.d.ts +2 -1
- package/es/auth/authenticators/authenticator.js +1 -0
- package/es/auth/authenticators/index.d.ts +2 -0
- package/es/auth/authenticators/index.js +1 -0
- package/es/auth/authenticators/mcsp-authenticator.d.ts +57 -0
- package/es/auth/authenticators/mcsp-authenticator.js +60 -0
- package/es/auth/token-managers/index.d.ts +5 -2
- package/es/auth/token-managers/index.js +5 -2
- package/es/auth/token-managers/mcsp-token-manager.d.ts +59 -0
- package/es/auth/token-managers/mcsp-token-manager.js +69 -0
- package/es/auth/utils/get-authenticator-from-environment.js +4 -1
- package/es/tsdoc-metadata.json +1 -1
- package/etc/ibm-cloud-sdk-core.api.md +23 -0
- package/ibm-cloud-sdk-core.d.ts +79 -0
- package/package.json +2 -2
- package/temp/ibm-cloud-sdk-core.api.json +319 -1
- package/temp/ibm-cloud-sdk-core.api.md +23 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* (C) Copyright IBM Corp. 2023.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { McspTokenManager } from '../token-managers/mcsp-token-manager';
|
|
17
|
+
import { BaseOptions, TokenRequestBasedAuthenticator } from './token-request-based-authenticator';
|
|
18
|
+
/** Configuration options for Multi-Cloud Saas Platform (MCSP) authentication. */
|
|
19
|
+
export interface Options extends BaseOptions {
|
|
20
|
+
/** The API key used to obtain an MCSP access token. */
|
|
21
|
+
apikey: string;
|
|
22
|
+
/** The URL representing the MCSP token service endpoint. */
|
|
23
|
+
url: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The McspAuthenticator uses an apikey to obtain an access token from the MCSP token server.
|
|
27
|
+
* When the access token expires, a new access token is obtained from the token server.
|
|
28
|
+
* The access token will be added to outbound requests via the Authorization header
|
|
29
|
+
* of the form: "Authorization: Bearer <access-token>"
|
|
30
|
+
*/
|
|
31
|
+
export declare class McspAuthenticator extends TokenRequestBasedAuthenticator {
|
|
32
|
+
protected requiredOptions: string[];
|
|
33
|
+
protected tokenManager: McspTokenManager;
|
|
34
|
+
private apikey;
|
|
35
|
+
/**
|
|
36
|
+
* Create a new McspAuthenticator instance.
|
|
37
|
+
*
|
|
38
|
+
* @param options - Configuration options for CloudPakForData authentication.
|
|
39
|
+
* This should be an object containing these fields:
|
|
40
|
+
* - url: (required) the endpoint URL for the CloudPakForData token service
|
|
41
|
+
* - username: (required) the username used to obtain a bearer token
|
|
42
|
+
* - password: (optional) the password used to obtain a bearer token (required if apikey is not specified)
|
|
43
|
+
* - apikey: (optional) the API key used to obtain a bearer token (required if password is not specified)
|
|
44
|
+
* - disableSslVerification: (optional) a flag that indicates whether verification of the token server's SSL certificate
|
|
45
|
+
* should be disabled or not
|
|
46
|
+
* - headers: (optional) a set of HTTP headers to be sent with each request to the token service
|
|
47
|
+
*
|
|
48
|
+
* @throws Error: the username, password, and/or url are not valid, or unspecified, for Cloud Pak For Data token requests.
|
|
49
|
+
*/
|
|
50
|
+
constructor(options: Options);
|
|
51
|
+
/**
|
|
52
|
+
* Returns the authenticator's type ('cp4d').
|
|
53
|
+
*
|
|
54
|
+
* @returns a string that indicates the authenticator's type
|
|
55
|
+
*/
|
|
56
|
+
authenticationType(): string;
|
|
57
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* (C) Copyright IBM Corp. 2023.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Authenticator } from './authenticator';
|
|
17
|
+
import { McspTokenManager } from '../token-managers/mcsp-token-manager';
|
|
18
|
+
import { TokenRequestBasedAuthenticator } from './token-request-based-authenticator';
|
|
19
|
+
/**
|
|
20
|
+
* The McspAuthenticator uses an apikey to obtain an access token from the MCSP token server.
|
|
21
|
+
* When the access token expires, a new access token is obtained from the token server.
|
|
22
|
+
* The access token will be added to outbound requests via the Authorization header
|
|
23
|
+
* of the form: "Authorization: Bearer <access-token>"
|
|
24
|
+
*/
|
|
25
|
+
export class McspAuthenticator extends TokenRequestBasedAuthenticator {
|
|
26
|
+
/**
|
|
27
|
+
* Create a new McspAuthenticator instance.
|
|
28
|
+
*
|
|
29
|
+
* @param options - Configuration options for CloudPakForData authentication.
|
|
30
|
+
* This should be an object containing these fields:
|
|
31
|
+
* - url: (required) the endpoint URL for the CloudPakForData token service
|
|
32
|
+
* - username: (required) the username used to obtain a bearer token
|
|
33
|
+
* - password: (optional) the password used to obtain a bearer token (required if apikey is not specified)
|
|
34
|
+
* - apikey: (optional) the API key used to obtain a bearer token (required if password is not specified)
|
|
35
|
+
* - disableSslVerification: (optional) a flag that indicates whether verification of the token server's SSL certificate
|
|
36
|
+
* should be disabled or not
|
|
37
|
+
* - headers: (optional) a set of HTTP headers to be sent with each request to the token service
|
|
38
|
+
*
|
|
39
|
+
* @throws Error: the username, password, and/or url are not valid, or unspecified, for Cloud Pak For Data token requests.
|
|
40
|
+
*/
|
|
41
|
+
constructor(options) {
|
|
42
|
+
super(options);
|
|
43
|
+
this.requiredOptions = ['apikey', 'url'];
|
|
44
|
+
this.apikey = options.apikey;
|
|
45
|
+
this.url = options.url;
|
|
46
|
+
// the param names are shared between the authenticator and the token
|
|
47
|
+
// manager so we can just pass along the options object.
|
|
48
|
+
// also, the token manager will handle input validation
|
|
49
|
+
this.tokenManager = new McspTokenManager(options);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Returns the authenticator's type ('cp4d').
|
|
53
|
+
*
|
|
54
|
+
* @returns a string that indicates the authenticator's type
|
|
55
|
+
*/
|
|
56
|
+
// eslint-disable-next-line class-methods-use-this
|
|
57
|
+
authenticationType() {
|
|
58
|
+
return Authenticator.AUTHTYPE_MCSP;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* (C) Copyright IBM Corp. 2019,
|
|
2
|
+
* (C) Copyright IBM Corp. 2019, 2023.
|
|
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,15 +21,17 @@
|
|
|
21
21
|
* Cloud Pak for Data
|
|
22
22
|
* Container (IKS, etc)
|
|
23
23
|
* VPC Instance
|
|
24
|
+
* Multi-Cloud Saas Platform (MCSP)
|
|
24
25
|
*
|
|
25
26
|
* The token managers sit inside of an authenticator and do the work to retrieve
|
|
26
|
-
* tokens
|
|
27
|
+
* tokens, whereas the authenticators add these tokens to the actual request.
|
|
27
28
|
*
|
|
28
29
|
* classes:
|
|
29
30
|
* IamTokenManager: Token Manager of IAM via apikey.
|
|
30
31
|
* Cp4dTokenManager: Token Manager of CloudPak for data.
|
|
31
32
|
* ContainerTokenManager: Token manager of IAM via compute resource token.
|
|
32
33
|
* VpcInstanceTokenManager: Token manager of VPC Instance Metadata Service API tokens.
|
|
34
|
+
* McspTokenManager: Token Manager of MCSP via apikey.
|
|
33
35
|
* JwtTokenManager: A class for shared functionality for parsing, storing, and requesting JWT tokens.
|
|
34
36
|
*/
|
|
35
37
|
export { IamTokenManager } from './iam-token-manager';
|
|
@@ -39,3 +41,4 @@ export { IamRequestBasedTokenManager, IamRequestOptions } from './iam-request-ba
|
|
|
39
41
|
export { JwtTokenManager, JwtTokenManagerOptions } from './jwt-token-manager';
|
|
40
42
|
export { TokenManager, TokenManagerOptions } from './token-manager';
|
|
41
43
|
export { VpcInstanceTokenManager } from './vpc-instance-token-manager';
|
|
44
|
+
export { McspTokenManager } from './mcsp-token-manager';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* (C) Copyright IBM Corp. 2019,
|
|
2
|
+
* (C) Copyright IBM Corp. 2019, 2023.
|
|
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,15 +21,17 @@
|
|
|
21
21
|
* Cloud Pak for Data
|
|
22
22
|
* Container (IKS, etc)
|
|
23
23
|
* VPC Instance
|
|
24
|
+
* Multi-Cloud Saas Platform (MCSP)
|
|
24
25
|
*
|
|
25
26
|
* The token managers sit inside of an authenticator and do the work to retrieve
|
|
26
|
-
* tokens
|
|
27
|
+
* tokens, whereas the authenticators add these tokens to the actual request.
|
|
27
28
|
*
|
|
28
29
|
* classes:
|
|
29
30
|
* IamTokenManager: Token Manager of IAM via apikey.
|
|
30
31
|
* Cp4dTokenManager: Token Manager of CloudPak for data.
|
|
31
32
|
* ContainerTokenManager: Token manager of IAM via compute resource token.
|
|
32
33
|
* VpcInstanceTokenManager: Token manager of VPC Instance Metadata Service API tokens.
|
|
34
|
+
* McspTokenManager: Token Manager of MCSP via apikey.
|
|
33
35
|
* JwtTokenManager: A class for shared functionality for parsing, storing, and requesting JWT tokens.
|
|
34
36
|
*/
|
|
35
37
|
export { IamTokenManager } from './iam-token-manager';
|
|
@@ -39,3 +41,4 @@ export { IamRequestBasedTokenManager } from './iam-request-based-token-manager';
|
|
|
39
41
|
export { JwtTokenManager } from './jwt-token-manager';
|
|
40
42
|
export { TokenManager } from './token-manager';
|
|
41
43
|
export { VpcInstanceTokenManager } from './vpc-instance-token-manager';
|
|
44
|
+
export { McspTokenManager } from './mcsp-token-manager';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* (C) Copyright IBM Corp. 2023.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { JwtTokenManager, JwtTokenManagerOptions } from './jwt-token-manager';
|
|
17
|
+
/**
|
|
18
|
+
* Configuration options for MCSP token retrieval.
|
|
19
|
+
*/
|
|
20
|
+
interface Options extends JwtTokenManagerOptions {
|
|
21
|
+
/** The API key used to obtain an access token. */
|
|
22
|
+
apikey: string;
|
|
23
|
+
/** The base endpoint URL for MCSP token requests. */
|
|
24
|
+
url: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* This interface models the response object received from the MCSP token service.
|
|
28
|
+
*/
|
|
29
|
+
export interface McspTokenData {
|
|
30
|
+
token: string;
|
|
31
|
+
token_type: string;
|
|
32
|
+
expires_in: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Token Manager for Multi-Cloud Saas Platform (MCSP) authenticator.
|
|
36
|
+
*
|
|
37
|
+
* The Token Manager will invoke the MCSP token service's 'POST /siusermgr/api/1.0/apikeys/token'
|
|
38
|
+
* operation to obtain an MCSP access token for a user-supplied apikey.
|
|
39
|
+
*/
|
|
40
|
+
export declare class McspTokenManager extends JwtTokenManager {
|
|
41
|
+
protected requiredOptions: string[];
|
|
42
|
+
private apikey;
|
|
43
|
+
/**
|
|
44
|
+
* Create a new McspTokenManager instance.
|
|
45
|
+
*
|
|
46
|
+
* @param options - Configuration options
|
|
47
|
+
* This should be an object containing these fields:
|
|
48
|
+
* - url: (required) the base endpoint URL for the MCSP token service
|
|
49
|
+
* - apikey: (required) the API key used to obtain the MCSP access token.
|
|
50
|
+
* - disableSslVerification: (optional) a flag that indicates whether verification of the token server's SSL certificate
|
|
51
|
+
* should be disabled or not
|
|
52
|
+
* - headers: (optional) a set of HTTP headers to be sent with each request to the token service
|
|
53
|
+
*
|
|
54
|
+
* @throws Error: the configuration options were invalid.
|
|
55
|
+
*/
|
|
56
|
+
constructor(options: Options);
|
|
57
|
+
protected requestToken(): Promise<any>;
|
|
58
|
+
}
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* (C) Copyright IBM Corp. 2023.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import extend from 'extend';
|
|
17
|
+
import { validateInput } from '../utils/helpers';
|
|
18
|
+
import { JwtTokenManager } from './jwt-token-manager';
|
|
19
|
+
/**
|
|
20
|
+
* This is the path associated with the operation used to obtain
|
|
21
|
+
* an access token from the MCSP token service.
|
|
22
|
+
*/
|
|
23
|
+
const OPERATION_PATH = '/siusermgr/api/1.0/apikeys/token';
|
|
24
|
+
/**
|
|
25
|
+
* Token Manager for Multi-Cloud Saas Platform (MCSP) authenticator.
|
|
26
|
+
*
|
|
27
|
+
* The Token Manager will invoke the MCSP token service's 'POST /siusermgr/api/1.0/apikeys/token'
|
|
28
|
+
* operation to obtain an MCSP access token for a user-supplied apikey.
|
|
29
|
+
*/
|
|
30
|
+
export class McspTokenManager extends JwtTokenManager {
|
|
31
|
+
/**
|
|
32
|
+
* Create a new McspTokenManager instance.
|
|
33
|
+
*
|
|
34
|
+
* @param options - Configuration options
|
|
35
|
+
* This should be an object containing these fields:
|
|
36
|
+
* - url: (required) the base endpoint URL for the MCSP token service
|
|
37
|
+
* - apikey: (required) the API key used to obtain the MCSP access token.
|
|
38
|
+
* - disableSslVerification: (optional) a flag that indicates whether verification of the token server's SSL certificate
|
|
39
|
+
* should be disabled or not
|
|
40
|
+
* - headers: (optional) a set of HTTP headers to be sent with each request to the token service
|
|
41
|
+
*
|
|
42
|
+
* @throws Error: the configuration options were invalid.
|
|
43
|
+
*/
|
|
44
|
+
constructor(options) {
|
|
45
|
+
super(options);
|
|
46
|
+
this.requiredOptions = ['apikey', 'url'];
|
|
47
|
+
this.tokenName = 'token';
|
|
48
|
+
validateInput(options, this.requiredOptions);
|
|
49
|
+
this.apikey = options.apikey;
|
|
50
|
+
}
|
|
51
|
+
requestToken() {
|
|
52
|
+
const requiredHeaders = {
|
|
53
|
+
Accept: 'application/json',
|
|
54
|
+
'Content-Type': 'application/json',
|
|
55
|
+
};
|
|
56
|
+
const parameters = {
|
|
57
|
+
options: {
|
|
58
|
+
url: this.url + OPERATION_PATH,
|
|
59
|
+
body: {
|
|
60
|
+
apikey: this.apikey,
|
|
61
|
+
},
|
|
62
|
+
method: 'POST',
|
|
63
|
+
headers: extend(true, {}, this.headers, requiredHeaders),
|
|
64
|
+
rejectUnauthorized: !this.disableSslVerification,
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
return this.requestWrapperInstance.sendRequest(parameters);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Authenticator, BasicAuthenticator, BearerTokenAuthenticator, CloudPakForDataAuthenticator, IamAuthenticator, ContainerAuthenticator, NoAuthAuthenticator, VpcInstanceAuthenticator, } from '../authenticators';
|
|
16
|
+
import { Authenticator, BasicAuthenticator, BearerTokenAuthenticator, CloudPakForDataAuthenticator, IamAuthenticator, ContainerAuthenticator, NoAuthAuthenticator, VpcInstanceAuthenticator, McspAuthenticator, } from '../authenticators';
|
|
17
17
|
import { readExternalSources } from './read-external-sources';
|
|
18
18
|
/**
|
|
19
19
|
* Look for external configuration of authenticator.
|
|
@@ -84,6 +84,9 @@ export function getAuthenticatorFromEnvironment(serviceName) {
|
|
|
84
84
|
else if (authType === Authenticator.AUTHTYPE_VPC.toLowerCase()) {
|
|
85
85
|
authenticator = new VpcInstanceAuthenticator(credentials);
|
|
86
86
|
}
|
|
87
|
+
else if (authType === Authenticator.AUTHTYPE_MCSP.toLowerCase()) {
|
|
88
|
+
authenticator = new McspAuthenticator(credentials);
|
|
89
|
+
}
|
|
87
90
|
else {
|
|
88
91
|
throw new Error(`Invalid value for AUTH_TYPE: ${authType}`);
|
|
89
92
|
}
|
package/es/tsdoc-metadata.json
CHANGED
|
@@ -34,6 +34,8 @@ export class Authenticator implements AuthenticatorInterface {
|
|
|
34
34
|
// (undocumented)
|
|
35
35
|
static AUTHTYPE_IAM: string;
|
|
36
36
|
// (undocumented)
|
|
37
|
+
static AUTHTYPE_MCSP: string;
|
|
38
|
+
// (undocumented)
|
|
37
39
|
static AUTHTYPE_NOAUTH: string;
|
|
38
40
|
// (undocumented)
|
|
39
41
|
static AUTHTYPE_UNKNOWN: string;
|
|
@@ -329,6 +331,27 @@ export class JwtTokenManager extends TokenManager {
|
|
|
329
331
|
// @public
|
|
330
332
|
export type JwtTokenManagerOptions = TokenManagerOptions;
|
|
331
333
|
|
|
334
|
+
// @public
|
|
335
|
+
export class McspAuthenticator extends TokenRequestBasedAuthenticator {
|
|
336
|
+
// Warning: (ae-forgotten-export) The symbol "Options_12" needs to be exported by the entry point index.d.ts
|
|
337
|
+
constructor(options: Options_12);
|
|
338
|
+
authenticationType(): string;
|
|
339
|
+
// (undocumented)
|
|
340
|
+
protected requiredOptions: string[];
|
|
341
|
+
// (undocumented)
|
|
342
|
+
protected tokenManager: McspTokenManager;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// @public
|
|
346
|
+
export class McspTokenManager extends JwtTokenManager {
|
|
347
|
+
// Warning: (ae-forgotten-export) The symbol "Options_11" needs to be exported by the entry point index.d.ts
|
|
348
|
+
constructor(options: Options_11);
|
|
349
|
+
// (undocumented)
|
|
350
|
+
protected requestToken(): Promise<any>;
|
|
351
|
+
// (undocumented)
|
|
352
|
+
protected requiredOptions: string[];
|
|
353
|
+
}
|
|
354
|
+
|
|
332
355
|
// @public
|
|
333
356
|
export class NoAuthAuthenticator extends Authenticator {
|
|
334
357
|
// (undocumented)
|
package/ibm-cloud-sdk-core.d.ts
CHANGED
|
@@ -53,6 +53,7 @@ export declare class Authenticator implements AuthenticatorInterface {
|
|
|
53
53
|
static AUTHTYPE_CP4D: string;
|
|
54
54
|
static AUTHTYPE_NOAUTH: string;
|
|
55
55
|
static AUTHTYPE_VPC: string;
|
|
56
|
+
static AUTHTYPE_MCSP: string;
|
|
56
57
|
static AUTHTYPE_UNKNOWN: string;
|
|
57
58
|
/**
|
|
58
59
|
* Create a new Authenticator instance.
|
|
@@ -1039,6 +1040,66 @@ export declare class JwtTokenManager extends TokenManager {
|
|
|
1039
1040
|
/** Configuration options for JWT token retrieval. */
|
|
1040
1041
|
export declare type JwtTokenManagerOptions = TokenManagerOptions;
|
|
1041
1042
|
|
|
1043
|
+
/**
|
|
1044
|
+
* The McspAuthenticator uses an apikey to obtain an access token from the MCSP token server.
|
|
1045
|
+
* When the access token expires, a new access token is obtained from the token server.
|
|
1046
|
+
* The access token will be added to outbound requests via the Authorization header
|
|
1047
|
+
* of the form: "Authorization: Bearer <access-token>"
|
|
1048
|
+
*/
|
|
1049
|
+
export declare class McspAuthenticator extends TokenRequestBasedAuthenticator {
|
|
1050
|
+
protected requiredOptions: string[];
|
|
1051
|
+
protected tokenManager: McspTokenManager;
|
|
1052
|
+
private apikey;
|
|
1053
|
+
/**
|
|
1054
|
+
* Create a new McspAuthenticator instance.
|
|
1055
|
+
*
|
|
1056
|
+
* @param options - Configuration options for CloudPakForData authentication.
|
|
1057
|
+
* This should be an object containing these fields:
|
|
1058
|
+
* - url: (required) the endpoint URL for the CloudPakForData token service
|
|
1059
|
+
* - username: (required) the username used to obtain a bearer token
|
|
1060
|
+
* - password: (optional) the password used to obtain a bearer token (required if apikey is not specified)
|
|
1061
|
+
* - apikey: (optional) the API key used to obtain a bearer token (required if password is not specified)
|
|
1062
|
+
* - disableSslVerification: (optional) a flag that indicates whether verification of the token server's SSL certificate
|
|
1063
|
+
* should be disabled or not
|
|
1064
|
+
* - headers: (optional) a set of HTTP headers to be sent with each request to the token service
|
|
1065
|
+
*
|
|
1066
|
+
* @throws Error: the username, password, and/or url are not valid, or unspecified, for Cloud Pak For Data token requests.
|
|
1067
|
+
*/
|
|
1068
|
+
constructor(options: Options_12);
|
|
1069
|
+
/**
|
|
1070
|
+
* Returns the authenticator's type ('cp4d').
|
|
1071
|
+
*
|
|
1072
|
+
* @returns a string that indicates the authenticator's type
|
|
1073
|
+
*/
|
|
1074
|
+
authenticationType(): string;
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
/**
|
|
1078
|
+
* Token Manager for Multi-Cloud Saas Platform (MCSP) authenticator.
|
|
1079
|
+
*
|
|
1080
|
+
* The Token Manager will invoke the MCSP token service's 'POST /siusermgr/api/1.0/apikeys/token'
|
|
1081
|
+
* operation to obtain an MCSP access token for a user-supplied apikey.
|
|
1082
|
+
*/
|
|
1083
|
+
export declare class McspTokenManager extends JwtTokenManager {
|
|
1084
|
+
protected requiredOptions: string[];
|
|
1085
|
+
private apikey;
|
|
1086
|
+
/**
|
|
1087
|
+
* Create a new McspTokenManager instance.
|
|
1088
|
+
*
|
|
1089
|
+
* @param options - Configuration options
|
|
1090
|
+
* This should be an object containing these fields:
|
|
1091
|
+
* - url: (required) the base endpoint URL for the MCSP token service
|
|
1092
|
+
* - apikey: (required) the API key used to obtain the MCSP access token.
|
|
1093
|
+
* - disableSslVerification: (optional) a flag that indicates whether verification of the token server's SSL certificate
|
|
1094
|
+
* should be disabled or not
|
|
1095
|
+
* - headers: (optional) a set of HTTP headers to be sent with each request to the token service
|
|
1096
|
+
*
|
|
1097
|
+
* @throws Error: the configuration options were invalid.
|
|
1098
|
+
*/
|
|
1099
|
+
constructor(options: Options_11);
|
|
1100
|
+
protected requestToken(): Promise<any>;
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1042
1103
|
/**
|
|
1043
1104
|
* NoAuthAuthenticator is a placeholder authenticator implementation which
|
|
1044
1105
|
* performs no authentication of outgoing REST API requests. It might be
|
|
@@ -1082,6 +1143,24 @@ declare interface Options_10 extends BaseOptions {
|
|
|
1082
1143
|
iamProfileId?: string;
|
|
1083
1144
|
}
|
|
1084
1145
|
|
|
1146
|
+
/**
|
|
1147
|
+
* Configuration options for MCSP token retrieval.
|
|
1148
|
+
*/
|
|
1149
|
+
declare interface Options_11 extends JwtTokenManagerOptions {
|
|
1150
|
+
/** The API key used to obtain an access token. */
|
|
1151
|
+
apikey: string;
|
|
1152
|
+
/** The base endpoint URL for MCSP token requests. */
|
|
1153
|
+
url: string;
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
/** Configuration options for Multi-Cloud Saas Platform (MCSP) authentication. */
|
|
1157
|
+
declare interface Options_12 extends BaseOptions {
|
|
1158
|
+
/** The API key used to obtain an MCSP access token. */
|
|
1159
|
+
apikey: string;
|
|
1160
|
+
/** The URL representing the MCSP token service endpoint. */
|
|
1161
|
+
url: string;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1085
1164
|
/** Configuration options for bearer authentication. */
|
|
1086
1165
|
declare type Options_2 = {
|
|
1087
1166
|
/** The bearer token to be added to requests. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ibm-cloud-sdk-core",
|
|
3
|
-
"version": "4.1
|
|
3
|
+
"version": "4.2.1",
|
|
4
4
|
"description": "Core functionality to support SDKs generated with IBM's OpenAPI SDK Generator.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"typings": "./es/index.d.ts",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@types/isstream": "^0.1.0",
|
|
44
44
|
"@types/node": "~10.14.19",
|
|
45
45
|
"@types/tough-cookie": "^4.0.0",
|
|
46
|
-
"axios": "1.6.
|
|
46
|
+
"axios": "1.6.3",
|
|
47
47
|
"camelcase": "^5.3.1",
|
|
48
48
|
"debug": "^4.3.4",
|
|
49
49
|
"dotenv": "^6.2.0",
|