ibm-cloud-sdk-core 2.7.2 → 2.8.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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [2.8.0](https://github.com/IBM/node-sdk-core/compare/v2.7.2...v2.8.0) (2021-02-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **iam-authenticator:** expose refresh token with a getter - `getRefreshToken()` ([#122](https://github.com/IBM/node-sdk-core/issues/122)) ([d3c4611](https://github.com/IBM/node-sdk-core/commit/d3c46116e42ae6aff9e4a686e9ae4212635e46f2))
|
|
7
|
+
|
|
1
8
|
## [2.7.2](https://github.com/IBM/node-sdk-core/compare/v2.7.1...v2.7.2) (2021-02-10)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -85,4 +85,11 @@ export declare class IamAuthenticator extends TokenRequestBasedAuthenticator {
|
|
|
85
85
|
* @param {string} scope A space seperated string that makes up the scope parameter
|
|
86
86
|
*/
|
|
87
87
|
setScope(scope: string): void;
|
|
88
|
+
/**
|
|
89
|
+
* Return the most recently stored refresh token.
|
|
90
|
+
*
|
|
91
|
+
* @public
|
|
92
|
+
* @returns {string}
|
|
93
|
+
*/
|
|
94
|
+
getRefreshToken(): string;
|
|
88
95
|
}
|
|
@@ -98,6 +98,15 @@ var IamAuthenticator = /** @class */ (function (_super) {
|
|
|
98
98
|
// update properties in token manager
|
|
99
99
|
this.tokenManager.setScope(scope);
|
|
100
100
|
};
|
|
101
|
+
/**
|
|
102
|
+
* Return the most recently stored refresh token.
|
|
103
|
+
*
|
|
104
|
+
* @public
|
|
105
|
+
* @returns {string}
|
|
106
|
+
*/
|
|
107
|
+
IamAuthenticator.prototype.getRefreshToken = function () {
|
|
108
|
+
return this.tokenManager.getRefreshToken();
|
|
109
|
+
};
|
|
101
110
|
return IamAuthenticator;
|
|
102
111
|
}(token_request_based_authenticator_1.TokenRequestBasedAuthenticator));
|
|
103
112
|
exports.IamAuthenticator = IamAuthenticator;
|
|
@@ -28,6 +28,7 @@ interface Options extends JwtTokenManagerOptions {
|
|
|
28
28
|
*/
|
|
29
29
|
export declare class IamTokenManager extends JwtTokenManager {
|
|
30
30
|
protected requiredOptions: string[];
|
|
31
|
+
protected refreshToken: string;
|
|
31
32
|
private apikey;
|
|
32
33
|
private clientId;
|
|
33
34
|
private clientSecret;
|
|
@@ -72,6 +73,22 @@ export declare class IamTokenManager extends JwtTokenManager {
|
|
|
72
73
|
* @returns {void}
|
|
73
74
|
*/
|
|
74
75
|
setClientIdAndSecret(clientId: string, clientSecret: string): void;
|
|
76
|
+
/**
|
|
77
|
+
* Return the most recently stored refresh token.
|
|
78
|
+
*
|
|
79
|
+
* @public
|
|
80
|
+
* @returns {string}
|
|
81
|
+
*/
|
|
82
|
+
getRefreshToken(): string;
|
|
83
|
+
/**
|
|
84
|
+
* Extend this method from the parent class to extract the refresh token from
|
|
85
|
+
* the request and save it.
|
|
86
|
+
*
|
|
87
|
+
* @param tokenResponse - Response object from JWT service request
|
|
88
|
+
* @protected
|
|
89
|
+
* @returns {void}
|
|
90
|
+
*/
|
|
91
|
+
protected saveTokenInfo(tokenResponse: any): void;
|
|
75
92
|
/**
|
|
76
93
|
* Request an IAM token using an API key.
|
|
77
94
|
*
|
|
@@ -123,6 +123,30 @@ var IamTokenManager = /** @class */ (function (_super) {
|
|
|
123
123
|
logger_1.default.warn(CLIENT_ID_SECRET_WARNING);
|
|
124
124
|
}
|
|
125
125
|
};
|
|
126
|
+
/**
|
|
127
|
+
* Return the most recently stored refresh token.
|
|
128
|
+
*
|
|
129
|
+
* @public
|
|
130
|
+
* @returns {string}
|
|
131
|
+
*/
|
|
132
|
+
IamTokenManager.prototype.getRefreshToken = function () {
|
|
133
|
+
return this.refreshToken;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Extend this method from the parent class to extract the refresh token from
|
|
137
|
+
* the request and save it.
|
|
138
|
+
*
|
|
139
|
+
* @param tokenResponse - Response object from JWT service request
|
|
140
|
+
* @protected
|
|
141
|
+
* @returns {void}
|
|
142
|
+
*/
|
|
143
|
+
IamTokenManager.prototype.saveTokenInfo = function (tokenResponse) {
|
|
144
|
+
_super.prototype.saveTokenInfo.call(this, tokenResponse);
|
|
145
|
+
var responseBody = tokenResponse.result || {};
|
|
146
|
+
if (responseBody.refresh_token) {
|
|
147
|
+
this.refreshToken = responseBody.refresh_token;
|
|
148
|
+
}
|
|
149
|
+
};
|
|
126
150
|
/**
|
|
127
151
|
* Request an IAM token using an API key.
|
|
128
152
|
*
|