@cloudbase/toolbox 0.7.9-beta.0 → 0.7.10
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/lib/auth/index.d.ts +1 -1
- package/lib/auth/index.js +3 -5
- package/package.json +1 -1
package/lib/auth/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export declare class AuthSupevisor {
|
|
|
23
23
|
constructor(options?: AuthSupevisorOptions);
|
|
24
24
|
getLoginState(): Promise<Credential>;
|
|
25
25
|
loginByWebAuth(options?: WebAuthOptions): Promise<Credential>;
|
|
26
|
-
loginByApiSecret(secretId?: string, secretKey?: string, token?: string): Promise<Credential>;
|
|
26
|
+
loginByApiSecret(secretId?: string, secretKey?: string, token?: string, additionalCredentialFields?: Omit<Credential, 'secretId' | 'secretKey' | 'token'>): Promise<Credential>;
|
|
27
27
|
logout(): Promise<void>;
|
|
28
28
|
private isCacheExpire;
|
|
29
29
|
}
|
package/lib/auth/index.js
CHANGED
|
@@ -99,7 +99,7 @@ class AuthSupevisor {
|
|
|
99
99
|
return credential;
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
|
-
loginByApiSecret(secretId, secretKey, token) {
|
|
102
|
+
loginByApiSecret(secretId, secretKey, token, additionalCredentialFields) {
|
|
103
103
|
return __awaiter(this, void 0, void 0, function* () {
|
|
104
104
|
if (this.cacheCredential && this.needCache && !this.isCacheExpire()) {
|
|
105
105
|
return this.cacheCredential;
|
|
@@ -110,11 +110,9 @@ class AuthSupevisor {
|
|
|
110
110
|
if (!secretId || !secretKey) {
|
|
111
111
|
throw new error_1.CloudBaseError('secretId 或 secretKey 不能为空');
|
|
112
112
|
}
|
|
113
|
-
credential = {
|
|
114
|
-
secretId,
|
|
113
|
+
credential = Object.assign(Object.assign({}, additionalCredentialFields), { secretId,
|
|
115
114
|
secretKey,
|
|
116
|
-
token
|
|
117
|
-
};
|
|
115
|
+
token });
|
|
118
116
|
try {
|
|
119
117
|
yield (0, common_1.checkAuth)(credential, this.requestConfig);
|
|
120
118
|
}
|