Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Host Option in OAuth #86

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/services/oauth2.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ function OAuth2(options){
// This option is necessary when the Oauth service has a self-signed cert.
// Hopefully this is only set to false in the safety of testing but not out in the wild.
this.rejectUnauthorizedRequests = !(options && options.rejectUnauthorized == false);

this.host = options.host || null;

EventEmitter.call(this);
}

Expand All @@ -19,7 +20,9 @@ OAuth2.prototype.parseURI = function(request) {
, secure = request.connection.encrypted || proto == "https"
, protocol = secure ? "https" : "http"
, host = request.headers.host || request.connection.remoteAddress


if (this.host) host = this.host;

return url.parse(protocol + "://" + host + request.url, true)
}

Expand Down