diff --git a/app.js b/app.js index cd46dc14..396abd2f 100644 --- a/app.js +++ b/app.js @@ -949,6 +949,12 @@ function processRequest(req, res, next) { options.path += apiConfig.auth.key.param + '=' + apiKey; } + // Basic Auth support + if (apiConfig.auth == 'basicAuth') { + options.headers['Authorization'] = 'Basic ' + new Buffer(reqQuery.apiUsername + ':' + reqQuery.apiPassword).toString('base64'); + console.log(options.headers['Authorization'] ); + } + // // Perform signature routine - force defaults on required configuration items. // diff --git a/dump.rdb b/dump.rdb new file mode 100644 index 00000000..7270819a Binary files /dev/null and b/dump.rdb differ diff --git a/public/javascripts/docs.js b/public/javascripts/docs.js index 1bcf61d4..dfcae90e 100644 --- a/public/javascripts/docs.js +++ b/public/javascripts/docs.js @@ -193,9 +193,11 @@ var params = $(this).serializeArray(), apiKey = { name: 'apiKey', value: $('input[name=key]').val() }, apiSecret = { name: 'apiSecret', value: $('input[name=secret]').val() }, - apiName = { name: 'apiName', value: $('input[name=apiName]').val() }; + apiName = { name: 'apiName', value: $('input[name=apiName]').val() }, + apiUsername = { name: 'apiUsername', value: $('input[name=username]').val() }, + apiPassword = { name: 'apiPassword', value: $('input[name=password]').val() };; - params.push(apiKey, apiSecret, apiName); + params.push(apiKey, apiSecret, apiName, apiUsername, apiPassword); //Accounts for array values for (i in params) { diff --git a/views/api.jade b/views/api.jade index 66b5bdaf..a01734cd 100644 --- a/views/api.jade +++ b/views/api.jade @@ -37,14 +37,22 @@ block content - if (oAuthVersion) label(for='key') Client ID - var secure ='authrequired' + input(id='key', name='key', value=defaultKey, style='color=#EEEEEE') + - else if (apiInfo.auth == 'basicAuth') + label(for='username') User name + input(id='username', name='username', value=defaultKey, style='color=#EEEEEE') - else label(for='key') API Key - var secure ='' - input(id='key', name='key', value=defaultKey, style='color=#EEEEEE') + input(id='key', name='key', value=defaultKey, style='color=#EEEEEE') div - if (oAuthVersion) label(for='secret') Client Secret input(id='secret', name='secret', value=defaultSecret, style='color=#EEEEEE') + - else if (apiInfo.auth == 'basicAuth') + label(for='password') Password + input(id='password', name='password', type='password', value=defaultKey, style='color=#EEEEEE') + - if (apiInfo.auth.signature) label(for='secret') Shared Secret input(id='secret', name='secret', value=defaultSecret, style='color=#EEEEEE')