X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=skyquake%2Fframework%2Fcore%2Fapi_utils%2Futils.js;h=5b17279d5af68b95f64ff237d24ebfe6972ce483;hb=f2dc2462571800e62cba969964de621dca09299c;hp=bd99fe1a9a8924f37b77d330068b9e4af5a29213;hpb=b78fbe20fd7d976b3e15abb2387b4e329a5ea918;p=osm%2FUI.git diff --git a/skyquake/framework/core/api_utils/utils.js b/skyquake/framework/core/api_utils/utils.js index bd99fe1a9..5b17279d5 100644 --- a/skyquake/framework/core/api_utils/utils.js +++ b/skyquake/framework/core/api_utils/utils.js @@ -217,32 +217,13 @@ var passThroughConstructor = function(app) { }); } - -var testAuthentication = function(app) { - app.get('/check-auth', function(req, res) { - console.log('testing auth') - var api_server = req.query["api_server"]; - var uri = confdPort(api_server) + '/api/config/'; - new Promise(function(resolve, reject) { - request({ - uri: uri, - method: 'GET', - headers: _.extend({}, CONSTANTS.HTTP_HEADERS.accept[type], { - 'Authorization': req.get('Authorization'), - forever: CONSTANTS.FOREVER_ON, - rejectUnauthorized: false, - }) - }, function(error, response, body) { - if (validateResponse('Passthrough: ' + url, error, response, body, resolve, reject)) { - resolve(JSON.parse(response.body)) - }; - }); - }).then(function(data) { - res.send(data); - }, function(error) { - res.send({'error': error, uri: uri}) - });; - }) +var getPortForProtocol = function(protocol) { + switch (protocol) { + case 'http': + return 8000; + case 'https': + return 8443; + } } module.exports = { @@ -263,5 +244,5 @@ module.exports = { passThroughConstructor: passThroughConstructor, - testAuthentication: testAuthentication + getPortForProtocol: getPortForProtocol };