How to use the @supermap/iclient-common.Credential function in @supermap/iclient-common

To help you get started, we’ve selected a few @supermap/iclient-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SuperMap / iClient-JavaScript / src / openlayers / overlay / VectorTileSuperMapRest.js View on Github external
function appendCredential(url, serverType) {
            var newUrl = url,
                credential,
                value;
            switch (serverType) {
                case ServerType.IPORTAL:
                    value = SecurityManager.getToken(url);
                    credential = value ? new Credential(value, 'token') : null;
                    if (!credential) {
                        value = SecurityManager.getKey(url);
                        credential = value ? new Credential(value, 'key') : null;
                    }
                    break;
                case ServerType.ONLINE:
                    value = SecurityManager.getKey(url);
                    credential = value ? new Credential(value, 'key') : null;
                    break;
                default:
                    //iserver or others
                    value = SecurityManager.getToken(url);
                    credential = value ? new Credential(value, 'token') : null;
                    break;
            }
            if (credential) {
github SuperMap / iClient-JavaScript / src / leaflet / overlay / TileVectorLayer.js View on Github external
_getCredential: function (url) {
        var credential, value;
        switch (this.options.serverType) {
            case ServerType.IPORTAL:
                value = SecurityManager.getToken(url);
                credential = value ? new Credential(value, "token") : null;
                if (!credential) {
                    value = SecurityManager.getKey(url);
                    credential = value ? new Credential(value, "key") : null;
                }
                break;
            case ServerType.ONLINE:
                value = SecurityManager.getKey(url);
                credential = value ? new Credential(value, "key") : null;
                break;
            default:
                //iserver or others
                value = SecurityManager.getToken(url);
                credential = value ? new Credential(value, "token") : null;
                break;
        }
        if (credential) {
            return credential.getUrlParameters();
        }
        return null;
github SuperMap / iClient-JavaScript / src / openlayers / overlay / VectorTileSuperMapRest.js View on Github external
case ServerType.IPORTAL:
                    value = SecurityManager.getToken(url);
                    credential = value ? new Credential(value, 'token') : null;
                    if (!credential) {
                        value = SecurityManager.getKey(url);
                        credential = value ? new Credential(value, 'key') : null;
                    }
                    break;
                case ServerType.ONLINE:
                    value = SecurityManager.getKey(url);
                    credential = value ? new Credential(value, 'key') : null;
                    break;
                default:
                    //iserver or others
                    value = SecurityManager.getToken(url);
                    credential = value ? new Credential(value, 'token') : null;
                    break;
            }
            if (credential) {
                newUrl += '&' + credential.getUrlParameters();
            }
            return newUrl;
        }
github SuperMap / iClient-JavaScript / src / leaflet / mapping / ImageMapLayer.js View on Github external
case ServerType.IPORTAL:
                value = SecurityManager.getToken(this._url);
                credential = value ? new Credential(value, 'token') : null;
                if (!credential) {
                    value = SecurityManager.getKey(this._url);
                    credential = value ? new Credential(value, 'key') : null;
                }
                break;
            case ServerType.ONLINE:
                value = SecurityManager.getKey(this._url);
                credential = value ? new Credential(value, 'key') : null;
                break;
            default:
                //iserver or others
                value = SecurityManager.getToken(this._url);
                credential = value ? new Credential(value, 'token') : null;
                break;
        }
        if (credential) {
            newUrl += '&' + credential.getUrlParameters();
        }
        return newUrl;
    }
});
github SuperMap / iClient-JavaScript / src / openlayers / mapping / ImageSuperMapRest.js View on Github external
case ServerType.IPORTAL:
          value = SecurityManager.getToken(id);
          credential = value ? new Credential(value, 'token') : null;
          if (!credential) {
            value = SecurityManager.getKey(id);
            credential = value ? new Credential(value, 'key') : null;
          }
          break;
        case ServerType.ONLINE:
          value = SecurityManager.getKey(id);
          credential = value ? new Credential(value, 'key') : null;
          break;
        default:
          //iserver or others
          value = SecurityManager.getToken(id);
          credential = value ? new Credential(value, 'token') : null;
          break;
      }
      if (credential) {
        newUrl += '&' + credential.getUrlParameters();
      }
      return newUrl;
    }
github SuperMap / iClient-JavaScript / src / openlayers / mapping / ImageSuperMapRest.js View on Github external
function appendCredential(id, url, serverType) {
      var newUrl = url,
        credential,
        value;
      switch (serverType) {
        case ServerType.IPORTAL:
          value = SecurityManager.getToken(id);
          credential = value ? new Credential(value, 'token') : null;
          if (!credential) {
            value = SecurityManager.getKey(id);
            credential = value ? new Credential(value, 'key') : null;
          }
          break;
        case ServerType.ONLINE:
          value = SecurityManager.getKey(id);
          credential = value ? new Credential(value, 'key') : null;
          break;
        default:
          //iserver or others
          value = SecurityManager.getToken(id);
          credential = value ? new Credential(value, 'token') : null;
          break;
      }
      if (credential) {
        newUrl += '&' + credential.getUrlParameters();
      }
      return newUrl;
github SuperMap / iClient-JavaScript / src / leaflet / overlay / TileVectorLayer.js View on Github external
_getCredential: function (url) {
        var credential, value;
        switch (this.options.serverType) {
            case ServerType.IPORTAL:
                value = SecurityManager.getToken(url);
                credential = value ? new Credential(value, "token") : null;
                if (!credential) {
                    value = SecurityManager.getKey(url);
                    credential = value ? new Credential(value, "key") : null;
                }
                break;
            case ServerType.ONLINE:
                value = SecurityManager.getKey(url);
                credential = value ? new Credential(value, "key") : null;
                break;
            default:
                //iserver or others
                value = SecurityManager.getToken(url);
                credential = value ? new Credential(value, "token") : null;
                break;
        }
        if (credential) {
github SuperMap / iClient-JavaScript / src / openlayers / mapping / TileSuperMapRest.js View on Github external
function appendCredential(url, serverType) {
            var newUrl = url,
                credential, value;
            switch (serverType) {
                case ServerType.IPORTAL:
                    value = SecurityManager.getToken(me._url);
                    credential = value ? new Credential(value, "token") : null;
                    if (!credential) {
                        value = SecurityManager.getKey(me._url);
                        credential = value ? new Credential(value, "key") : null;
                    }
                    break;
                case ServerType.ONLINE:
                    value = SecurityManager.getKey(me._url);
                    credential = value ? new Credential(value, "key") : null;
                    break;
                default:
                    //iserver or others
                    value = SecurityManager.getToken(me._url);
                    credential = value ? new Credential(value, "token") : null;
                    break;
            }
            if (credential) {