heroku-bouncer
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -29,3 +29,7 @@ 'use strict'; | ||
if (!options.hasOwnProperty('ignoreRoutes')) { | ||
options.ignoreRoutes = []; | ||
} | ||
options.herokuAuthURL || (options.herokuAuthURL = 'https://id.heroku.com'); | ||
} |
@@ -10,2 +10,12 @@ 'use strict'; | ||
return function(req, res, next) { | ||
var i, route; | ||
for (i = 0; i < options.ignoreRoutes.length; i++) { | ||
route = options.ignoreRoutes[i]; | ||
if (req.url.match(route)) { | ||
return next(); | ||
} | ||
} | ||
if (req.session.userSession || isOAuthPath(req.path)) { | ||
@@ -12,0 +22,0 @@ if (req.session.userSession) { |
{ | ||
"name": "heroku-bouncer", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "heroku bouncer middleware for express", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -20,3 +20,3 @@ # node-heroku-bouncer | ||
Use the `bouncer.middleware` object to set up middleware that will ensure that | ||
your users are logged in (and redirect otherwise), and the `bouncer.roues` | ||
your users are logged in (and redirect otherwise), and the `bouncer.routes` | ||
object to add the OAuth-specific routes to your app: | ||
@@ -60,1 +60,4 @@ | ||
``` | ||
[cookieParser]: http://expressjs.com/3x/api.html#cookieParser | ||
[cookieSession]: http://expressjs.com/3x/api.html#cookieSession |
@@ -13,3 +13,4 @@ 'use strict'; | ||
herokuBouncerSecret: 'bouncer-secret', | ||
herokuAuthURL : 'http://localhost:' + serverPort | ||
herokuAuthURL : 'http://localhost:' + serverPort, | ||
ignoreRoutes : [/^\/ignore/] | ||
}); | ||
@@ -36,3 +37,7 @@ | ||
app.get('/ignore', function(req, res) { | ||
res.end('no redirect'); | ||
}); | ||
return server; | ||
} |
@@ -104,2 +104,16 @@ 'use strict'; | ||
}); | ||
describe('ignoring routes', function() { | ||
it('ignores specified routes', function(done) { | ||
request({ | ||
url: 'http://localhost:' + clientPort + '/ignore', | ||
followRedirect: false | ||
}, function(err, res) { | ||
if (err) throw err; | ||
res.body.should.eql('no redirect'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
10442
269
62
2