diff --git a/lib/cas.js b/lib/cas.js index d35152e..367b9ac 100644 --- a/lib/cas.js +++ b/lib/cas.js @@ -35,12 +35,13 @@ var CAS = module.exports = function CAS(options) { } else if (!cas_url.hostname) { throw new Error('Option `base_url` must be a valid url like: https://example.com/cas'); } else { - this.hostname = cas_url.host; + this.hostname = cas_url.hostname; this.port = cas_url.port || 443; this.base_path = cas_url.pathname; } this.service = options.service; + this.https_options = options.https; }; /** @@ -59,14 +60,20 @@ CAS.version = '0.0.1'; */ CAS.prototype.validate = function(ticket, callback) { - var req = https.get({ + var options = { host: this.hostname, port: this.port, path: url.format({ pathname: this.base_path+'/validate', query: {ticket: ticket, service: this.service} }) - }, function(res) { + }; + for (var opt in this.https_options) { + if (this.https_options.hasOwnProperty(opt)) { + options[opt] = this.https_options[opt]; + } + } + var req = https.get(options, function(res) { // Handle server errors res.on('error', function(e) { callback(e); @@ -95,4 +102,4 @@ CAS.prototype.validate = function(ticket, callback) { callback({message: 'Bad response format.'}); }); }); -}; \ No newline at end of file +}; diff --git a/package.json b/package.json index 7ae9ea4..a0ce7d0 100644 --- a/package.json +++ b/package.json @@ -6,5 +6,5 @@ "author": "Casey Banner ", "dependencies": {}, "main": "index", - "engines": { "node": "0.4 || 0.5 || 0.6" } + "engines": { "node": "0.4 || 0.5 || 0.6 || 0.8 || 0.10" } }