diff --git a/index.js b/index.js index 8528cac..500888e 100644 --- a/index.js +++ b/index.js @@ -3,30 +3,30 @@ * pointing to the correct working dir for the app. Update the working dir * before doing anything involving relative paths. */ -if (process.env.AUSPICE_HOME) { - console.log("Changing home directory to " + process.env.AUSPICE_HOME); - process.chdir(process.env.AUSPICE_HOME); +if (process.env.OAUTH_REVERSE_PROXY_HOME) { + console.log("Changing home directory to " + process.env.OAUTH_REVERSE_PROXY_HOME); + process.chdir(process.env.OAUTH_REVERSE_PROXY_HOME); } -var auspice = require('./lib'); +var oauth_reverse_proxy = require('./lib'); var logger = require('./lib/logger.js'); /** * The config path can be provided as an environemnt variable. If not rpvoided, we chose * sane defaults for Windows and non-Windows. */ -var config_path = process.env.AUSPICE_CONFIG_PATH; +var config_path = process.env.OAUTH_REVERSE_PROXY_CONFIG_PATH; if (!config_path) { var os = require('os').type().toLowerCase(); if (os.indexOf('windows') !== -1 || os.indexOf('cygwin') !== -1) { - config_path = "C:\\ProgramData\\auspice\\config.d\\"; + config_path = "C:\\ProgramData\\oauth_reverse_proxy\\config.d\\"; } else { - config_path = "/etc/auspice.d/"; + config_path = "/etc/oauth_reverse_proxy.d/"; } } -// Create an auspice instance at our configured root dir. -auspice.init(config_path, function(err, proxy) { +// Create an oauth_reverse_proxy instance at our configured root dir. +oauth_reverse_proxy.init(config_path, function(err, proxy) { // If we caught a fatal error creating the proxies, log it and pause briefly before exiting // to give Bunyan a chance to flush this error message. if (err) { diff --git a/lib/index.js b/lib/index.js index e030805..2afa800 100644 --- a/lib/index.js +++ b/lib/index.js @@ -7,7 +7,7 @@ var ProxyConfig = require('./proxy/config.js'); var logger = require('./logger.js'); /** - * An Auspice instance is initialized around a configuration directory. Each Auspice proxy + * An oauth_reverse_proxy instance is initialized around a configuration directory. Each proxy * is represented by a JSON configuration file in this directory. * * The directory is loaded once on startup. There is currently no provision for polling configuration @@ -21,7 +21,7 @@ exports.init = function(config_dir, cb) { /* istanbul ignore next */ if (err) return cb("Failed to open directory " + config_dir); - if (!stat.isDirectory()) return cb('Auspice config dir is not a directory'); + if (!stat.isDirectory()) return cb('oauth_reverse_proxy config dir is not a directory'); // Load all proxy configurations. loadConfigFiles(config_dir, cb); diff --git a/lib/logger.js b/lib/logger.js index 3cbf976..3ae65a3 100644 --- a/lib/logger.js +++ b/lib/logger.js @@ -3,7 +3,7 @@ var util = require('util'); var bunyan = require('bunyan'); // Create a default logger to use if all else fails. -module.exports = bunyan.createLogger({name: 'auspice'}); +module.exports = bunyan.createLogger({name: 'oauth_reverse_proxy'}); // Init the logger with a configuration object /* istanbul ignore next */ diff --git a/lib/proxy/authenticator.js b/lib/proxy/authenticator.js index cd677d0..c7eb2ee 100644 --- a/lib/proxy/authenticator.js +++ b/lib/proxy/authenticator.js @@ -16,7 +16,7 @@ var OAUTH_SIGNATURE_METHOD = 'oauth_signature_method'; var OAUTH_TIMESTAMP = 'oauth_timestamp'; var OAUTH_VERSION = 'oauth_version'; -var CONSUMER_KEY_HEADER = exports.CONSUMER_KEY_HEADER = 'x-vp-auspice-consumer-key'; +var CONSUMER_KEY_HEADER = exports.CONSUMER_KEY_HEADER = 'x-oauth-reverse-proxy-consumer-key'; /** * All of these parameters must be present in a valid oauth header or query string. @@ -367,7 +367,7 @@ exports.oauthValidator = function(keys) { var signature_bases = constructStringsToSign(req, argument_pairs, consumer_secret); // Because python (and possibly) some other libraries do not encode the signature, we can avoid spurious - // validation failures by comparing decoded signatures against the hash value computed by Auspice. + // validation failures by comparing decoded signatures against the hash value computed by oauth_reverse_proxy. oauth_params[OAUTH_SIGNATURE] = encoding.decodeData(oauth_params[OAUTH_SIGNATURE]); while (signature_bases.length > 0) { diff --git a/lib/proxy/config.js b/lib/proxy/config.js index ba284f9..200e009 100644 --- a/lib/proxy/config.js +++ b/lib/proxy/config.js @@ -4,10 +4,9 @@ var util = require('util'); var logger = require('../logger.js'); /** - * The proxy config is a representation of a JSON configuration file from the Auspice - * config directory. This class is responsible for exposing only those fields in the - * JSON that map to valid proxy configuration and for validating that the configuration - * is legitimate. + * The proxy config is a representation of a JSON configuration file from the oauth_reverse_proxy + * config directory. This class is responsible for exposing only those fields in the JSON that + * map to valid proxy configuration and for validating that the configuration is legitimate. */ function ProxyConfig(config) { var this_obj = this; @@ -57,14 +56,3 @@ ProxyConfig.prototype.isValid = function() { }; module.exports = ProxyConfig; - -/** -var pc = new ProxyConfig({ - 'from_port': 8888, - 'to_port': 7000, - 'keystore': '/var/lib/auspice/8888/7000' -}); - -logger.info(pc.from_port); -logger.info(pc.validate()); -**/ diff --git a/lib/proxy/header_modifier.js b/lib/proxy/header_modifier.js index 4cc07a1..acfedb9 100644 --- a/lib/proxy/header_modifier.js +++ b/lib/proxy/header_modifier.js @@ -1,6 +1,6 @@ var uuid = require('node-uuid'); -// Return the port, either by parsing the host header or by determining whether Auspice did ssl +// Return the port, either by parsing the host header or by determining whether oauth_reverse_proxy did ssl // termination for the request. function getPortForRequest(req) { var port = req.headers.host.match(/:(\d+)/); @@ -21,14 +21,14 @@ function safelySetHeader(req, header_name, header_value) { } } -var AUSPICE_VERSION = process.env.AUSPICE_VERSION || "tst"; +var OAUTH_REVERSE_PROXY_VERSION = process.env.OAUTH_REVERSE_PROXY_VERSION || "tst"; // The Via header value won't change during runtime of this process, so create it once at startup. -var DEFAULT_VIA_HEADER = '1.1 localhost (Auspice v' + AUSPICE_VERSION + ')'; +var DEFAULT_VIA_HEADER = '1.1 localhost (oauth_reverse_proxy v' + OAUTH_REVERSE_PROXY_VERSION + ')'; // Append x-forwarded-for, x-forwarded-port, x-forwarded-proto, x-forwarded-host, and via to the request // headers before proxying to the target server. If these headers are already set, append information -// received by Auspice to the existing headers. +// received by oauth_reverse_proxy to the existing headers. exports.applyXForwardedHeaders = function() { return function(req, res, next) { diff --git a/lib/proxy/index.js b/lib/proxy/index.js index 5da1074..251c89c 100644 --- a/lib/proxy/index.js +++ b/lib/proxy/index.js @@ -23,7 +23,7 @@ var HTTP_AGENT = http.globalAgent; HTTP_AGENT.maxSockets = 1000; /** - * An Auspice proxy is initialized around a JSON value that defines the necessary components + * An oauth_reverse_proxy is initialized around a JSON value that defines the necessary components * of any proxy, such as the from and to ports as well as the directory in which OAuth secrets * are stored. * @@ -32,13 +32,13 @@ HTTP_AGENT.maxSockets = 1000; * * An example proxy configured with a single consumer key named 'test-key' and consumer secret * of 'terrible-consumer-secret' would contain the following as the sole entry in the - * a keystore directory of /var/auspice/8000/80: + * a keystore directory of /var/oauth_reverse_proxy/8000/80: * - * /var/auspice/8000/80/test-key + * /var/oauth_reverse_proxy/8000/80/test-key * * The contents of this file would be 'terrible-consumer-secret' * - * An Auspice proxy will manage its keystore and watch for changes to the filesystem. As + * An oauth_reverse_proxy will manage its keystore and watch for changes to the filesystem. As * keys are added, removed, or changed, the proxy will dynamically reconfigure to reflect the * new set of credentials. */ @@ -83,7 +83,7 @@ Proxy.prototype.start = function(cb) { return next(); } - res.writeHead(413, "URL exceeds maximum allowed length for Auspice"); + res.writeHead(413, "URL exceeds maximum allowed length for oauth_reverse_proxy"); res.end(); }, // Parse query string @@ -136,5 +136,5 @@ Proxy.prototype.start = function(cb) { }); }; -// Expose Proxy class to auspice. +// Expose Proxy class. module.exports = Proxy; diff --git a/test/auspice_abnormal_config.js b/test/auth_proxy_abnormal_config.js similarity index 63% rename from test/auspice_abnormal_config.js rename to test/auth_proxy_abnormal_config.js index 5d8aec6..81a25f4 100644 --- a/test/auspice_abnormal_config.js +++ b/test/auth_proxy_abnormal_config.js @@ -4,7 +4,7 @@ var _ = require('underscore'); var mkdirp = require('mkdirp'); var rimraf = require('rimraf'); -var auspice = require('../lib'); +var oauth_reverse_proxy = require('../lib'); var Proxy = require('../lib/proxy'); // Start every test with an empty keys directory. @@ -20,33 +20,33 @@ var slate_cleaner = function(done) { } }; -// Attempt to initiate Auspice with various forms of broken config. -describe('Auspice config validation', function() { +// Attempt to initiate oauth_reverse_proxy with various forms of broken config. +describe('oauth_reverse_proxy config validation', function() { - // Before attempting to start Auspice, clean the malformed directories we need for test purposes. + // Before attempting to start oauth_reverse_proxy, clean the malformed directories we need for test purposes. beforeEach(slate_cleaner); // After we're done with all these tests and we've butchered our keys directory to a fair-thee-well, // kill it with fire. after(slate_cleaner); - it ('should reject an attempt to init Auspice with an unset config_dir parameter', function(done) { - auspice.init(null, function(err, proxy) { + it ('should reject an attempt to init oauth_reverse_proxy with an unset config_dir parameter', function(done) { + oauth_reverse_proxy.init(null, function(err, proxy) { err.should.equal('Failed to open directory ' + null); done(); }); }); - it ('should reject an attempt to init Auspice with a config_dir referencing a nonexistent directory', function(done) { - auspice.init('./test/keys', function(err, proxy) { + it ('should reject an attempt to init oauth_reverse_proxy with a config_dir referencing a nonexistent directory', function(done) { + oauth_reverse_proxy.init('./test/keys', function(err, proxy) { err.should.equal('Failed to open directory ./test/keys'); done(); }); }); - it ('should reject an attempt to init Auspice with a config_dir referencing a non-directory inode', function(done) { - auspice.init('./test/auspice_abnormal_config.js', function(err, proxy) { - err.should.equal('Auspice config dir is not a directory'); + it ('should reject an attempt to init oauth_reverse_proxy with a config_dir referencing a non-directory inode', function(done) { + oauth_reverse_proxy.init('./test/auth_proxy_abnormal_config.js', function(err, proxy) { + err.should.equal('oauth_reverse_proxy config dir is not a directory'); done(); }); }); @@ -55,7 +55,7 @@ describe('Auspice config validation', function() { // Attempt to initiate a proxy with various forms of broken key directories. describe('Proxy config validation', function() { - // Before attempting to start Auspice, clean the malformed directories we need for test purposes. + // Before attempting to start oauth-reverse_proxy, clean the malformed directories we need for test purposes. beforeEach(slate_cleaner); // After we're done with all these tests and we've butchered our keys directory to a fair-thee-well, diff --git a/test/auspice_bootstrap_test.js b/test/auth_proxy_bootstrap_test.js similarity index 91% rename from test/auspice_bootstrap_test.js rename to test/auth_proxy_bootstrap_test.js index 1d95ae6..d49b195 100644 --- a/test/auspice_bootstrap_test.js +++ b/test/auth_proxy_bootstrap_test.js @@ -5,7 +5,7 @@ var rimraf = require('rimraf'); var mkdirp = require('mkdirp'); var crypto = require('crypto'); -var auspice = require('../lib'); +var oauth_reverse_proxy = require('../lib'); var keygen = require('../utils/keygen.js'); var request_sender = require('./utils/request_sender.js'); @@ -22,13 +22,13 @@ beforeEach(function() { if (job_server) job_server.removeAllListeners(); }); -// Create an Auspice proxy, and validate that it works properly even if there is no server +// Create an oauth_reverse_proxy, and validate that it works properly even if there is no server // running behind it. Once this is done, start a server. After the completion of this // test, the preconditions for all other test cases are in place. Thus, every test case -// must require auspice_bootstrap_test. -describe('Auspice Bootstrap', function() { +// must require auth_bootstrap_test. +describe('oauth_reverse_proxy bootstrap', function() { - // Before starting Auspice, create the keys we need for test clients. + // Before starting our oauth_reverse_proxy, create the keys we need for test clients. before(function(done) { rimraf('./test/keys/8008/8080', function(err) { mkdirp('./test/keys/8008/8080', function(err) { @@ -90,8 +90,8 @@ describe('Auspice Bootstrap', function() { // Test that the proxy starts and loads all the keys created in the before function. it ('should start cleanly', function(done) { - auspice.init('./test/config.d', function(err, proxies) { - if (err) done('Auspice startup failed: ' + err); + oauth_reverse_proxy.init('./test/config.d', function(err, proxies) { + if (err) done('oauth_reverse_proxy startup failed: ' + err); exports.proxy = proxies["jobs_service.json"]; if (typeof exports.proxy === 'string') { diff --git a/test/auspice_dynamic_key_test.js b/test/auth_proxy_dynamic_key_test.js similarity index 67% rename from test/auspice_dynamic_key_test.js rename to test/auth_proxy_dynamic_key_test.js index 72f5ac2..170fdcf 100644 --- a/test/auspice_dynamic_key_test.js +++ b/test/auth_proxy_dynamic_key_test.js @@ -3,18 +3,18 @@ var should = require('should'); var _ = require('underscore'); var keygen = require('../utils/keygen.js'); -var auspice_bootstrap_test = require('./auspice_bootstrap_test.js'); +var auth_proxy_bootstrap_test = require('./auth_proxy_bootstrap_test.js'); -describe('Auspice Key Loader', function() { +describe('oauth_reverse_proxy key loader', function() { it ('should support adding keys dynamically', function(done) { keygen.createKey('./test/keys', 8008, 8080, 'dynamic-key', function(err) { keygen.createKey('./test/keys', 8008, 8080, 'dynamic-key2', function(err) { if (err) done(err); var check_key = function() { - if (auspice_bootstrap_test.proxy.keys['dynamic-key']) { + if (auth_proxy_bootstrap_test.proxy.keys['dynamic-key']) { // Turn the proxy.keys object into an array to get its length - auspice_bootstrap_test.proxy.keys.count.should.be.exactly(15); + auth_proxy_bootstrap_test.proxy.keys.count.should.be.exactly(15); done(); } else setTimeout(check_key, 50); }; @@ -28,10 +28,10 @@ describe('Auspice Key Loader', function() { keygen.createKey('./test/keys', 8008, 8080, 'dynamic-key', 'happy-fun-key', function(err) { if (err) done(err); var check_key = function() { - if (auspice_bootstrap_test.proxy.keys['dynamic-key'] === 'happy-fun-key') { + if (auth_proxy_bootstrap_test.proxy.keys['dynamic-key'] === 'happy-fun-key') { // Turn the proxy.keys object into an array to get its length - auspice_bootstrap_test.proxy.keys.count.should.be.exactly(15); - auspice_bootstrap_test.proxy.keys['dynamic-key'].should.equal('happy-fun-key'); + auth_proxy_bootstrap_test.proxy.keys.count.should.be.exactly(15); + auth_proxy_bootstrap_test.proxy.keys['dynamic-key'].should.equal('happy-fun-key'); done(); } else setTimeout(check_key, 50); }; @@ -45,10 +45,10 @@ describe('Auspice Key Loader', function() { fs.unlink('./test/keys/8008/8080/dynamic-key2', function(err) { if (err) done(err); var check_key = function() { - if (auspice_bootstrap_test.proxy.keys['dynamic-key']) setTimeout(check_key, 50); + if (auth_proxy_bootstrap_test.proxy.keys['dynamic-key']) setTimeout(check_key, 50); else { // Turn the proxy.keys object into an array to get its length - auspice_bootstrap_test.proxy.keys.count.should.be.exactly(13); + auth_proxy_bootstrap_test.proxy.keys.count.should.be.exactly(13); done(); } }; diff --git a/test/client_library_test.js b/test/client_library_test.js index 2663c86..55378cf 100644 --- a/test/client_library_test.js +++ b/test/client_library_test.js @@ -7,7 +7,7 @@ var os = require('os'); var job_server = require('./server/test_server.js').JobServer; -require('./auspice_bootstrap_test.js'); +require('./auth_proxy_bootstrap_test.js'); // Creates a convenience function for running an external client and validating that the correct // key is passed to the job server and the correct content is written to disk. @@ -27,7 +27,7 @@ var create_client_test = function(verb, cmd, cwd, key) { }; // These test clients are in the test/clients subdirectory. Each one tests a limited amount of OAuth -// functionality to validate that requests can be sent through Auspice properly using various languages. +// functionality to validate that requests can be sent through auth_proxy properly using various languages. describe('Client library tests', function() { it ('should support requests from ruby', function(done) { diff --git a/test/job_server_test.js b/test/job_server_test.js index db4ecb0..8a8faff 100644 --- a/test/job_server_test.js +++ b/test/job_server_test.js @@ -8,11 +8,11 @@ var validation_tools = require('./utils/validation_tools.js'); var test_server = require('./server/test_server.js'); var job_server = test_server.JobServer; -// Test the job server in isolation to make sure responses are handled as expected without Auspice involved. +// Test the job server in isolation to make sure responses are handled as expected without oauth_reverse_proxy involved. describe('Job Server', function() { - // Initiate the job server in case auspice_bootstrap_test.js has not been required. This is the only test - // case where it might be valid to start the job server without starting Auspice: we are only testing the + // Initiate the job server in case auth_proxy_bootstrap_test.js has not been required. This is the only test + // case where it might be valid to start the job server without starting oauth_reverse_proxy: we are only testing the // functionality of the job server here. before(function(done) { test_server.init(8080, function(err) { diff --git a/test/message_integrity_compression_test.js b/test/message_integrity_compression_test.js index 5d2cbae..f85758f 100644 --- a/test/message_integrity_compression_test.js +++ b/test/message_integrity_compression_test.js @@ -6,12 +6,12 @@ var util = require('util'); var request_sender = require('./utils/request_sender.js'); var validation_tools = require('./utils/validation_tools.js'); -// All tests must require auspice_bootstrap_test since that creates our proxy, starts our job server, and +// All tests must require auth_proxy_bootstrap_test since that creates our proxy, starts our job server, and // and registers a beforeEach to keep the request_sender and job_server clean between test runs. -require('./auspice_bootstrap_test.js'); +require('./auth_proxy_bootstrap_test.js'); -// Tests that compressed response content is handled by Auspice. -describe('Auspice message integrity: verbs', function() { +// Tests that compressed response content is handled by oauth_reverse_proxy. +describe('oauth_reverse_proxy message integrity: verbs', function() { ['GET', 'POST', 'PUT', 'DELETE'].forEach(function(verb) { diff --git a/test/message_integrity_formencoded_test.js b/test/message_integrity_formencoded_test.js index 8121774..2d9d34d 100644 --- a/test/message_integrity_formencoded_test.js +++ b/test/message_integrity_formencoded_test.js @@ -12,12 +12,12 @@ var job_server = require('./server/test_server.js').JobServer; var request_sender = require('./utils/request_sender.js'); var validation_tools = require('./utils/validation_tools.js'); -// All tests must require auspice_bootstrap_test since that creates our proxy, starts our job server, and +// All tests must require auth_proxy_bootstrap_test since that creates our proxy, starts our job server, and // and registers a beforeEach to keep the request_sender and job_server clean between test runs. -require('./auspice_bootstrap_test.js'); +require('./auth_proxy_bootstrap_test.js'); -// Tests that basic, formencoded POSTs and PUTs are handled correctly by Auspice. -describe('Auspice message integrity: formencoded', function() { +// Tests that basic, formencoded POSTs and PUTs are handled correctly by oauth_reverse_proxy. +describe('oauth_reverse_proxy message integrity: formencoded', function() { // Validate that a basic POST or PUT works. Loop over each verb, running the common tests between them. ['POST', 'PUT'].forEach(function(verb) { @@ -29,7 +29,7 @@ describe('Auspice message integrity: formencoded', function() { it ("should accept a properly signed " + verb + " with params", function(done) { job_server.once(verb + " /job", function(req, res) { - req.headers.should.have.property('x-vp-auspice-consumer-key', 'mocha-test-key'); + req.headers.should.have.property('x-oauth-reverse-proxy-consumer-key', 'mocha-test-key'); req.method.should.equal(verb); _.isEqual(req.body, {'submit':'ok'}).should.equal(true); }); diff --git a/test/message_integrity_header_test.js b/test/message_integrity_header_test.js index 744ba71..53aaeff 100644 --- a/test/message_integrity_header_test.js +++ b/test/message_integrity_header_test.js @@ -7,15 +7,15 @@ var job_server = require('./server/test_server.js').JobServer; var request_sender = require('./utils/request_sender.js'); var validation_tools = require('./utils/validation_tools.js'); -// All tests must require auspice_bootstrap_test since that creates our proxy, starts our job server, and +// All tests must require auth_proxy_bootstrap_test since that creates our proxy, starts our job server, and // and registers a beforeEach to keep the request_sender and job_server clean between test runs. -require('./auspice_bootstrap_test.js'); +require('./auth_proxy_bootstrap_test.js'); -// This is a set of tests to validate that Auspice does not tamper with the request or response +// This is a set of tests to validate that oauth_reverse_proxy does not tamper with the request or response // headers or other components of the messages that transit through the proxy. Unlike many of // the other test suites, this requires that we send two requests (one authenticated and one // unauthenticated) to validate that there are no unexpected differences in content. -describe('Auspice message integrity: headers', function() { +describe('oauth_reverse_proxy message integrity: headers', function() { // Run the message integrity validations once for each verb. ['GET', 'POST', 'PUT', 'DELETE'].forEach(function(verb) { diff --git a/test/message_integrity_json_test.js b/test/message_integrity_json_test.js index 0d2d5c0..94a4be9 100644 --- a/test/message_integrity_json_test.js +++ b/test/message_integrity_json_test.js @@ -13,12 +13,12 @@ var job_server = test_server.JobServer; var request_sender = require('./utils/request_sender.js'); var validation_tools = require('./utils/validation_tools.js'); -// All tests must require auspice_bootstrap_test since that creates our proxy, starts our job server, and +// All tests must require auth_proxy_bootstrap_test since that creates our proxy, starts our job server, and // and registers a beforeEach to keep the request_sender and job_server clean between test runs. -require('./auspice_bootstrap_test.js'); +require('./auth_proxy_bootstrap_test.js'); -// Validate that JSON requests and responses are properly routed through Auspice. -describe('Auspice message integrity: JSON', function() { +// Validate that JSON requests and responses are properly routed through oauth_reverse_proxy. +describe('oauth_reverse_proxy message integrity: JSON', function() { ['POST', 'PUT'].forEach(function(verb) { diff --git a/test/message_integrity_multipart_test.js b/test/message_integrity_multipart_test.js index 538149d..5fc1bb1 100644 --- a/test/message_integrity_multipart_test.js +++ b/test/message_integrity_multipart_test.js @@ -7,11 +7,11 @@ var validation_tools = require('./utils/validation_tools.js'); var job_server = require('./server/test_server.js').JobServer; -// All tests must require auspice_bootstrap_test since that creates our proxy, starts our job server, and +// All tests must require auth_proxy_bootstrap_test since that creates our proxy, starts our job server, and // and registers a beforeEach to keep the request_sender and job_server clean between test runs. -require('./auspice_bootstrap_test.js'); +require('./auth_proxy_bootstrap_test.js'); -describe('Auspice message integrity: multipart', function() { +describe('oauth_reverse_proxy message integrity: multipart', function() { ['POST', 'PUT'].forEach(function(verb) { // Validate that a multipart POST or PUT succeeds. diff --git a/test/message_integrity_soap_test.js b/test/message_integrity_soap_test.js index bb90dea..7de3912 100644 --- a/test/message_integrity_soap_test.js +++ b/test/message_integrity_soap_test.js @@ -9,12 +9,12 @@ var job_server = require('./server/test_server.js').JobServer; var request_sender = require('./utils/request_sender.js'); var validation_tools = require('./utils/validation_tools.js'); -// All tests must require auspice_bootstrap_test since that creates our proxy, starts our job server, and +// All tests must require auth_proxy_bootstrap_test since that creates our proxy, starts our job server, and // and registers a beforeEach to keep the request_sender and job_server clean between test runs. -require('./auspice_bootstrap_test.js'); +require('./auth_proxy_bootstrap_test.js'); -// Tests that SOAP-style messages are handled by Auspice -describe('Auspice message integrity: SOAP', function() { +// Tests that SOAP-style messages are handled by oauth_reverse_proxy +describe('oauth_reverse_proxy message integrity: SOAP', function() { // Test SOAP-ish messages it ('should handle a SOAP request', function(done) { diff --git a/test/message_integrity_verb_test.js b/test/message_integrity_verb_test.js index 0d760ca..8bcc816 100644 --- a/test/message_integrity_verb_test.js +++ b/test/message_integrity_verb_test.js @@ -3,12 +3,12 @@ var request_sender = require('./utils/request_sender.js'); var validation_tools = require('./utils/validation_tools.js'); -// All tests must require auspice_bootstrap_test since that creates our proxy, starts our job server, and +// All tests must require auth_proxy_bootstrap_test since that creates our proxy, starts our job server, and // and registers a beforeEach to keep the request_sender and job_server clean between test runs. -require('./auspice_bootstrap_test.js'); +require('./auth_proxy_bootstrap_test.js'); -// Tests that verbs are handled correctly by Auspice -describe('Auspice message integrity: verbs', function() { +// Tests that verbs are handled correctly by oauth_reverse_proxy +describe('oauth_reverse_proxy message integrity: verbs', function() { // GETs and DELETEs have the same URL format and do not expect input, so test them both in a loop. ['GET', 'DELETE'].forEach(function(verb) { diff --git a/test/oauth_credential_delivery_test.js b/test/oauth_credential_delivery_test.js index 0d47cb3..f8cd913 100644 --- a/test/oauth_credential_delivery_test.js +++ b/test/oauth_credential_delivery_test.js @@ -7,13 +7,13 @@ var validation_tools = require('./utils/validation_tools.js'); var test_server = require('./server/test_server.js'); var job_server = test_server.JobServer; -// All tests must require auspice_bootstrap_test since that creates our proxy, starts our job server, and +// All tests must require auth_proxy_bootstrap_test since that creates our proxy, starts our job server, and // and registers a beforeEach to keep the request_sender and job_server clean between test runs. -require('./auspice_bootstrap_test.js'); +require('./auth_proxy_bootstrap_test.js'); // This is a set of tests to validate that OAuth credentials can be sent on the query string or even in // the body of POSTs and PUTs in addition to via the more traditional Authorization header. -describe('Auspice OAuth credential transport', function() { +describe('oauth_reverse_proxy OAuth credential transport', function() { var validate_requests = function(verb, url, transport, options, request_setup_fn, done) { var alternative_transport_based_request; diff --git a/test/oauth_validations_test.js b/test/oauth_validations_test.js index b7b78b4..01fa534 100644 --- a/test/oauth_validations_test.js +++ b/test/oauth_validations_test.js @@ -2,15 +2,15 @@ var should = require('should'); var request_sender = require('./utils/request_sender.js'); -// All tests must require auspice_bootstrap_test since that creates our proxy, starts our job server, and +// All tests must require auth_proxy_bootstrap_test since that creates our proxy, starts our job server, and // and registers a beforeEach to keep the request_sender and job_server clean between test runs. -require('./auspice_bootstrap_test.js'); +require('./auth_proxy_bootstrap_test.js'); // This is a set of tests for missing OAuth components, incorrectly specified OAuth parameters, etc. These are -// health tests for our OAuth validations: any spurious 200s returned here represent weaknesses in Auspice's security. -describe('Auspice OAuth validations', function() { +// health tests for our OAuth validations: any spurious 200s returned here represent weaknesses in oauth_reverse_proxy's security. +describe('oauth_reverse_proxy OAuth validations', function() { - // Run these tests for each verb. While verb handling inside of Auspice is consistent and these results should + // Run these tests for each verb. While verb handling inside of oauth_reverse_proxy is consistent and these results should // always be the same, that may not always be the case. This is a hedge against future stupidity. ['GET', 'POST', 'PUT', 'DELETE'].forEach(function(verb) { @@ -119,7 +119,7 @@ describe('Auspice OAuth validations', function() { // Tests the validator's handling of specially formatted mock-requests, allowing us to get into the weeds // of specific use cases that might be difficult to achieve by sending actual requests. -describe('Auspice request validation', function() { +describe('oauth_reverse_proxy request validation', function() { var authenticator = require('../lib/proxy/authenticator.js'); diff --git a/test/proxy_header_tampering_test.js b/test/proxy_header_tampering_test.js index a31f34b..07ef7ea 100644 --- a/test/proxy_header_tampering_test.js +++ b/test/proxy_header_tampering_test.js @@ -8,12 +8,12 @@ var header_modifier = require('../lib/proxy/header_modifier.js'); // lives in request_sender. var request_sender = require('./utils/request_sender.js'); -// All tests must require auspice_bootstrap_test since that creates our proxy, starts our job server, and +// All tests must require auth_proxy_bootstrap_test since that creates our proxy, starts our job server, and // and registers a beforeEach to keep the request_sender and job_server clean between test runs. -require('./auspice_bootstrap_test.js'); +require('./auth_proxy_bootstrap_test.js'); -// This is a set of tests to validate that Auspice correctly adds the x-forwarded-* and via headers to the proxied request. -describe('Auspice request header tampering: addition of x-forwarded-* and via', function() { +// This is a set of tests to validate that oauth_reverse_proxy correctly adds the x-forwarded-* and via headers to the proxied request. +describe('oauth_reverse_proxy request header tampering: addition of x-forwarded-* and via', function() { it('should append correct headers for inbound HTTP connections', function(done) { // Validate that standard HTTP connection handling works. @@ -31,7 +31,7 @@ describe('Auspice request header tampering: addition of x-forwarded-* and via', stub_request.headers['x-forwarded-port'].should.equal('80'); stub_request.headers['x-forwarded-for'].should.equal('10.10.10.1'); stub_request.headers['x-forwarded-proto'].should.equal('http'); - stub_request.headers['via'].should.equal('1.1 localhost (Auspice vtst)'); + stub_request.headers['via'].should.equal('1.1 localhost (oauth_reverse_proxy vtst)'); done(); }); }); @@ -53,7 +53,7 @@ describe('Auspice request header tampering: addition of x-forwarded-* and via', stub_request.headers['x-forwarded-port'].should.equal('443'); stub_request.headers['x-forwarded-for'].should.equal('10.10.10.1'); stub_request.headers['x-forwarded-proto'].should.equal('https'); - stub_request.headers['via'].should.equal('1.1 localhost (Auspice vtst)'); + stub_request.headers['via'].should.equal('1.1 localhost (oauth_reverse_proxy vtst)'); done(); }); }); @@ -66,7 +66,7 @@ describe('Auspice request header tampering: addition of x-forwarded-* and via', ['x-forwarded-for', '127.0.0.1'], ['x-forwarded-port', '8008'], ['x-forwarded-proto', 'http'], - ['via', '1.1 localhost (Auspice vtst)'] + ['via', '1.1 localhost (oauth_reverse_proxy vtst)'] ]; it("should add x-forwarded-* and via headers to proxied " + verb + " requests", function(done) { @@ -88,7 +88,7 @@ describe('Auspice request header tampering: addition of x-forwarded-* and via', ['x-forwarded-for', '127.0.0.1'], ['x-forwarded-port', '8008'], ['x-forwarded-proto', 'http'], - ['via', '1.1 localhost (Auspice vtst)'] + ['via', '1.1 localhost (oauth_reverse_proxy vtst)'] ]; it("should add x-forwarded-* and via headers to proxied " + verb + " requests", function(done) { @@ -110,7 +110,7 @@ describe('Auspice request header tampering: addition of x-forwarded-* and via', ['x-forwarded-for', '127.0.0.1'], ['x-forwarded-port', '8008'], ['x-forwarded-proto', 'http'], - ['via', '1.1 localhost (Auspice vtst)'] + ['via', '1.1 localhost (oauth_reverse_proxy vtst)'] ]; it("should add x-forwarded-* and via headers to proxied " + verb + " requests", function(done) { @@ -132,7 +132,7 @@ describe('Auspice request header tampering: addition of x-forwarded-* and via', ['x-forwarded-for', '10.10.56.32,127.0.0.1'], ['x-forwarded-port', '8888,8008'], ['x-forwarded-proto', 'https,http'], - ['via', '1.1 devlexicebun001,1.1 localhost (Auspice v' + process.env.AUSPICE_VERSION + ')'] + ['via', '1.1 devlexicebun001,1.1 localhost (oauth_reverse_proxy vtst)'] ]; // The x-forwarded-proto header being HTTPs indicates to us that the original request was HTTPs and the only @@ -161,8 +161,8 @@ describe('Auspice request header tampering: addition of x-forwarded-* and via', }); }); -// This is a set of tests to validate that Auspice correctly modifies the host header in the proxied request. -describe('Auspice request header tampering: host', function() { +// This is a set of tests to validate that oauth_reverse_proxy correctly modifies the host header in the proxied request. +describe('oauth_reverse_proxy request header tampering: host', function() { // All of the below requests var stub_request; diff --git a/test/request_restrictions_test.js b/test/request_restrictions_test.js index c420724..786d81f 100644 --- a/test/request_restrictions_test.js +++ b/test/request_restrictions_test.js @@ -6,9 +6,9 @@ var job_server = require('./server/test_server.js').JobServer; // lives in request_sender. var request_sender = require('./utils/request_sender.js'); -// All tests must require auspice_bootstrap_test since that creates our proxy, starts our job server, and +// All tests must require auth_proxy_bootstrap_test since that creates our proxy, starts our job server, and // and registers a beforeEach to keep the request_sender and job_server clean between test runs. -require('./auspice_bootstrap_test.js'); +require('./auth_proxy_bootstrap_test.js'); describe('Additional request restrictions', function() { diff --git a/test/server/test_server.js b/test/server/test_server.js index 17f56ba..0a2ac91 100644 --- a/test/server/test_server.js +++ b/test/server/test_server.js @@ -15,7 +15,7 @@ app.DELETE = app.delete; const CONSUMER_KEY_HEADER = require('../../lib/proxy/authenticator.js').CONSUMER_KEY_HEADER; -// The job server represents a simple RESTful server we might expect to see behind Auspice. +// The job server represents they types of servers we might expect to see behind oauth_reverse_proxy. function JobServer() { var this_obj = this; diff --git a/test/utils/validation_tools.js b/test/utils/validation_tools.js index d2d6386..fa8895b 100644 --- a/test/utils/validation_tools.js +++ b/test/utils/validation_tools.js @@ -4,7 +4,7 @@ var should = require('should'); var stream = require('stream'); var util = require('util'); -exports.IGNORABLE_REQUEST_HEADERS = ['authorization', 'x-vp-auspice-consumer-key', 'content-type', 'via', 'x-vp-correlatorid']; +exports.IGNORABLE_REQUEST_HEADERS = ['authorization', 'x-oauth-reverse-proxy-consumer-key', 'content-type', 'via', 'x-vp-correlatorid']; ['for', 'port', 'proto'].forEach(function(header) { exports.IGNORABLE_REQUEST_HEADERS.push('x-forwarded-' + header); }); @@ -54,7 +54,7 @@ exports.createResponseValidator = function(expected_status_code, done) { if (err) return done(err); response.statusCode.should.equal(expected_status_code); // Validate that all responses have a connection header of keep-alive. For performance reasons, - // Auspice should never be disabling keep-alives. + // oauth_reverse_proxy should never be disabling keep-alives. response.headers.connection.should.equal('keep-alive'); // We know that all requests to the JobServer should return {"status":"ok"}, so add that validation. if (expected_status_code === 200 && response.request.path.indexOf('/job') != -1) body.should.equal('{"status":"ok"}'); diff --git a/test/whitelist_test.js b/test/whitelist_test.js index 8f83062..3d573b2 100644 --- a/test/whitelist_test.js +++ b/test/whitelist_test.js @@ -2,17 +2,17 @@ var should = require('should'); var fs = require('fs'); var request_sender = require('./utils/request_sender.js'); -// All tests must require auspice_bootstrap_test since that creates our proxy, starts our job server, and +// All tests must require auth_proxy_bootstrap_test since that creates our proxy, starts our job server, and // and registers a beforeEach to keep the request_sender and job_server clean between test runs. -require('./auspice_bootstrap_test.js'); +require('./auth_proxy_bootstrap_test.js'); // This is a set of tests for handling whitelisted URLs. As part of the bootstrap, we create a whitelist configuration // that allows /livecheck paths through the proxy unauthenticated if the verb is GET. // All other verbs and other URLs using the GET verb (for example, /healthcheck) are rejected in this configuration. // As are all other routes off of /livecheck (e.g. /livecheck/DeleteEverything) are also rejected in this configuration. // This is to prevent a crafty/lazy developer from using the /livecheck route as a way to tunnel information to their -// underlying service without authenticating. Auspice is, after all, a tool meant to enforce developer inconvenience. -describe('Auspice configurable whitelist exemptions', function() { +// underlying service without authenticating. oauth_reverse_proxy is, after all, a tool meant to enforce developer inconvenience. +describe('oauth_reverse_proxy configurable whitelist exemptions', function() { // Create a test case sending a url and expecting a given response. var create_livecheck_test = function(verb, url, expected_status_code) {