Skip to content

Commit 108794d

Browse files
committed
【features】ol TileSuperMapRest 支持urls和url中{?-?}来实现负载均衡
1 parent fa375f6 commit 108794d

File tree

5 files changed

+292
-148
lines changed

5 files changed

+292
-148
lines changed

src/common/security/SecurityManager.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,25 @@ export class SecurityManager {
332332
}
333333
return newUrl;
334334
}
335+
/**
336+
* @description 获取授权信息,授权信息需先通过SecurityManager.registerKey或SecurityManager.registerToken注册。
337+
* @version 12.1.0
338+
* @function SecurityManager.getCredential
339+
* @param {string} url - 服务URL。
340+
* @returns {Object} 返回授权信息 - 包含 name 和 value 的对象。
341+
*/
342+
static getCredential(url) {
343+
var value = this.getToken(url);
344+
var credential = value ? new Credential(value, 'token') : null;
345+
if (!credential) {
346+
value = this.getKey(url);
347+
credential = value ? new Credential(value, 'key') : null;
348+
}
349+
if (credential) {
350+
return {name: credential.name, value: credential.value};
351+
}
352+
return null;
353+
}
335354

336355
static _open(url, newTab) {
337356
newTab = newTab != null ? newTab : true;

0 commit comments

Comments
 (0)