Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const config = require('./config');
const logger = require('../logger/log')(config.serviceName, config.logLevel);
const tracer = require('../tracer/trace').jaegerTrace(config.serviceName, config.enableDistributedTracing);
const opentracing = require('opentracing');
const cors = require('cors');
const app = require('express')();
const https = require('https');
const http = require('http');
const url = require("url");
const transform = require('transformer-proxy');
const agentHTTP = new http.Agent({});
const agentHTTPS = new https.Agent({});
const proxy = require('http-proxy/lib/http-proxy').createProxyServer({});
const {httpAuth, transformURI, bgwIfy, REQ_TYPES} = require('./utils');
app.use(cors());
app.use('/status', async (req, res) => {
logger.log('debug', 'endpoint status called');
res.status(200).json({status: "ok"});
});
app.use('/callback', async (req, res) => {
let query = url.parse(req.url, true).query;
logger.log('debug', 'endpoint callback called', {queryState: query && query.state});
if (query && query.state) {