ibm-cloud-sdk-core
Advanced tools
Comparing version 2.4.5 to 2.5.0
@@ -32,2 +32,6 @@ /** | ||
clientSecret?: string; | ||
/** | ||
* The "scope" parameter to use when fetching the bearer token from the IAM token server. | ||
*/ | ||
scope?: string; | ||
} | ||
@@ -51,2 +55,3 @@ /** | ||
private clientSecret; | ||
private scope; | ||
/** | ||
@@ -67,2 +72,4 @@ * | ||
* authorization header for IAM token requests. | ||
* @param {string} [options.scope] The "scope" parameter to use when fetching the bearer token from the | ||
* IAM token server. | ||
* @throws {Error} When the configuration options are not valid. | ||
@@ -79,2 +86,7 @@ */ | ||
setClientIdAndSecret(clientId: string, clientSecret: string): void; | ||
/** | ||
* Setter for the "scope" parameter to use when fetching the bearer token from the IAM token server. | ||
* @param {string} scope A space seperated string that makes up the scope parameter | ||
*/ | ||
setScope(scope: string): void; | ||
} |
@@ -62,2 +62,4 @@ "use strict"; | ||
* authorization header for IAM token requests. | ||
* @param {string} [options.scope] The "scope" parameter to use when fetching the bearer token from the | ||
* IAM token server. | ||
* @throws {Error} When the configuration options are not valid. | ||
@@ -72,2 +74,3 @@ */ | ||
_this.clientSecret = options.clientSecret; | ||
_this.scope = options.scope; | ||
// the param names are shared between the authenticator and the token | ||
@@ -91,4 +94,13 @@ // manager so we can just pass along the options object | ||
}; | ||
/** | ||
* Setter for the "scope" parameter to use when fetching the bearer token from the IAM token server. | ||
* @param {string} scope A space seperated string that makes up the scope parameter | ||
*/ | ||
IamAuthenticator.prototype.setScope = function (scope) { | ||
this.scope = scope; | ||
// update properties in token manager | ||
this.tokenManager.setScope(scope); | ||
}; | ||
return IamAuthenticator; | ||
}(token_request_based_authenticator_1.TokenRequestBasedAuthenticator)); | ||
exports.IamAuthenticator = IamAuthenticator; |
@@ -22,2 +22,3 @@ /** | ||
clientSecret?: string; | ||
scope?: string; | ||
} | ||
@@ -34,2 +35,3 @@ /** | ||
private clientSecret; | ||
private scope; | ||
/** | ||
@@ -55,2 +57,11 @@ * | ||
/** | ||
* Set the IAM `scope` value. | ||
* This value is the form parameter to use when fetching the bearer token | ||
* from the IAM token server. | ||
* | ||
* @param {string} scope - A space seperated string that makes up the scope parameter. | ||
* @returns {void} | ||
*/ | ||
setScope(scope: string): void; | ||
/** | ||
* Set the IAM `clientId` and `clientSecret` values. | ||
@@ -57,0 +68,0 @@ * These values are used to compute the Authorization header used |
@@ -49,2 +49,3 @@ "use strict"; | ||
var CLIENT_ID_SECRET_WARNING = 'Warning: Client ID and Secret must BOTH be given, or the header will not be included.'; | ||
var SCOPE = 'scope'; | ||
/** | ||
@@ -87,2 +88,5 @@ * The IAMTokenManager takes an api key and performs the necessary interactions with | ||
} | ||
if (options.scope) { | ||
_this.scope = options.scope; | ||
} | ||
if (onlyOne(options.clientId, options.clientSecret)) { | ||
@@ -95,2 +99,13 @@ // tslint:disable-next-line | ||
/** | ||
* Set the IAM `scope` value. | ||
* This value is the form parameter to use when fetching the bearer token | ||
* from the IAM token server. | ||
* | ||
* @param {string} scope - A space seperated string that makes up the scope parameter. | ||
* @returns {void} | ||
*/ | ||
IamTokenManager.prototype.setScope = function (scope) { | ||
this.scope = scope; | ||
}; | ||
/** | ||
* Set the IAM `clientId` and `clientSecret` values. | ||
@@ -141,2 +156,5 @@ * These values are used to compute the Authorization header used | ||
}; | ||
if (this.scope) { | ||
parameters.options.form[SCOPE] = this.scope; | ||
} | ||
return this.requestWrapperInstance.sendRequest(parameters); | ||
@@ -143,0 +161,0 @@ }; |
@@ -0,1 +1,8 @@ | ||
# [2.5.0](https://github.com/IBM/node-sdk-core/compare/v2.4.5...v2.5.0) (2020-09-18) | ||
### Features | ||
* **IAM Authenticator:** add support for optional 'scope' property ([#109](https://github.com/IBM/node-sdk-core/issues/109)) ([1c258b7](https://github.com/IBM/node-sdk-core/commit/1c258b71470c0228e021c959984cc887d849887b)) | ||
## [2.4.5](https://github.com/IBM/node-sdk-core/compare/v2.4.4...v2.4.5) (2020-08-12) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "ibm-cloud-sdk-core", | ||
"version": "2.4.5", | ||
"version": "2.5.0", | ||
"description": "Core functionality to support SDKs generated with IBM's OpenAPI 3 SDK Generator.", | ||
@@ -5,0 +5,0 @@ "main": "index", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
212398
4051
143
0
0
20