Permalink
Browse files

Added alwaysDetectHostname as a configurable option. Important for us…

…e in subdomain architectures.
  • Loading branch information...
bnoguchi committed Jun 21, 2011
1 parent e9ac6f5 commit 4c96c60b2e37199fbf6ab4efd2ad3b7bcc24ab83
Showing with 15 additions and 4 deletions.
  1. +3 −1 lib/modules/googlehybrid.js
  2. +4 −1 lib/modules/oauth.js
  3. +4 −1 lib/modules/oauth2.js
  4. +4 −1 lib/modules/openid.js
@@ -49,7 +49,9 @@ openidModule.submodule('googlehybrid')
.sendToAuthenticationUri(function(req,res) {
// Automatic hostname detection + assignment
- if (!this._myHostname) this.myHostname(extractHostname(req));
+ if (!this._myHostname || this._alwaysDetectHostname) {
+ this.myHostname(extractHostname(req));
+ }
this.relyingParty.authenticate('http://www.google.com/accounts/o8/id', false, function(authenticationUrl){
if(authenticationUrl) {
View
@@ -14,6 +14,7 @@ everyModule.submodule('oauth')
, consumerKey: 'the api key provided by the OAuth provider'
, consumerSecret: 'the api secret provided by the OAuth provider'
, myHostname: 'e.g., http://localhost:3000 . Notice no trailing slash'
+ , alwaysDetectHostname: 'does not cache myHostname once. Instead, re-detect it on every request. Good for multiple subdomain architectures'
, redirectPath: 'Where to redirect to after a failed or successful OAuth authorization'
, convertErr: 'a function (data) that extracts an error message from data arg, where `data` is what is returned from a failed OAuth request'
})
@@ -75,7 +76,9 @@ everyModule.submodule('oauth')
.getRequestToken( function (req, res) {
// Automatic hostname detection + assignment
- if (!this._myHostname) this.myHostname(extractHostname(req));
+ if (!this._myHostname || this._alwaysDetectHostname) {
+ this.myHostname(extractHostname(req));
+ }
var p = this.Promise();
this.oauth.getOAuthRequestToken( function (err, token, tokenSecret, authUrl, params) {
View
@@ -28,6 +28,7 @@ everyModule.submodule('oauth2')
'token endpoint as a querysting; "data" to POST the params to ' +
'the access token endpoint in the request body'
, myHostname: 'e.g., http://local.host:3000 . Notice no trailing slash'
+ , alwaysDetectHostname: 'does not cache myHostname once. Instead, re-detect it on every request. Good for multiple subdomain architectures'
, redirectPath: 'Where to redirect to after a failed or successful OAuth authorization'
, convertErr: 'a function (data) that extracts an error message from data arg, where `data` is what is returned from a failed OAuth request'
@@ -85,7 +86,9 @@ everyModule.submodule('oauth2')
.getAuthUri( function (req, res) {
// Automatic hostname detection + assignment
- if (!this._myHostname) this.myHostname(extractHostname(req));
+ if (!this._myHostname || this._alwaysDetectHostname) {
+ this.myHostname(extractHostname(req));
+ }
var params = {
client_id: this.appId()
View
@@ -10,6 +10,7 @@ everyModule.submodule('openid')
simpleRegistration: 'e.g., {"nickname" : true}'
, attributeExchange: 'eg {"http://axschema.org/contact/email": "required"}'
, myHostname: 'e.g., http://localhost:3000 . Notice no trailing slash'
+ , alwaysDetectHostname: 'does not cache myHostname once. Instead, re-detect it on every request. Good for multiple subdomain architectures'
, redirectPath : 'The path to redirect To'
, openidURLField : 'The post field to use for open id'
})
@@ -47,7 +48,9 @@ everyModule.submodule('openid')
.sendToAuthenticationUri(function(req,res) {
// Automatic hostname detection + assignment
- if (!this._myHostname) this.myHostname(extractHostname(req));
+ if (!this._myHostname || this._alwaysDetectHostname) {
+ this.myHostname(extractHostname(req));
+ }
this.relyingParty.authenticate(req.query[this.openidURLField()], false, function(authenticationUrl){
if(authenticationUrl) {

0 comments on commit 4c96c60

Please sign in to comment.