Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var toEndpointProperties = function(apiSecurity) {
var rval:any = {};
if (apiSecurity.type == 'none') {
return rval;
}
rval['authorization.type'] = apiSecurity.type;
if (apiSecurity.type == 'basic' && apiSecurity.basic) {
rval['basic-auth.username'] = apiSecurity.basic.username;
rval['basic-auth.password'] = apiSecurity.basic.password;
if (apiSecurity.basic.requireSSL) {
rval['basic-auth.requireSSL'] = 'true';
} else {
rval['basic-auth.requireSSL'] = 'false';
}
}
return rval;
};