Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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) {
_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;
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;
}
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;
}
});
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;
}
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;
_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) {
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) {