heroku-bouncer
Advanced tools
Comparing version 2.0.0 to 2.0.1
34
index.js
@@ -6,2 +6,36 @@ 'use strict'; | ||
/** | ||
* `heroku-bouncer` is a function which exposes two things: A piece of | ||
* middleware to handle Heroku OAuth for a node app, and a router which exposes | ||
* the required OAuth endpoints (such as a callback URL), and a logout path. | ||
* | ||
* @class Main | ||
*/ | ||
/** | ||
* @method main | ||
* @param {Object} options | ||
* @param {String} options.herokuBouncerSecret a secret used to encrypt | ||
* information in the session | ||
* @param {String} options.herokuOAuthID an ID for a Heroku OAuth client | ||
* @param {String} options.herokuOAuthSecret a secret for a Heroku OAuth client | ||
* @param {Array} [options.ignoreRoutes=[]] an array of route regular expressions | ||
* to match request routes again. If a request route matches one of these, it | ||
* passes through the authentication stack instantly. | ||
* @param {String} [options.herokuAuthURL='https://id.heroku.com'] the | ||
* authentication URL used | ||
* @param {Boolean} [options.herokaiOnly=false] whether or not to restrict this | ||
* app to Herokai (users with @heroku.com email addresses) | ||
* @example | ||
* ```javascript | ||
* var bouncer = require('heroku-bouncer')({ | ||
* herokuBouncerSecret: process.env.HEROKU_BOUNCER_SECRET, | ||
* herokuOAuthID : process.env.HEROKU_OAUTH_ID, | ||
* herokuOAuthSecret : process.env.HEROKU_OAUTH_SECRET | ||
* }); | ||
* | ||
* app.use(bouncer.middleware); | ||
* app.use(bouncer.router); | ||
* ``` | ||
*/ | ||
module.exports = function(options) { | ||
@@ -8,0 +42,0 @@ options = options || {}; |
@@ -5,2 +5,19 @@ 'use strict'; | ||
/** | ||
* Middleware for using Heroku OAuth. | ||
* | ||
* @class Middleware | ||
*/ | ||
/** | ||
* Create a middleware function for using Heroku OAuth. If the user is | ||
* authenticated, it will add an API token, email, name and ID to the user's | ||
* request and session. | ||
* | ||
* @method main | ||
* @param {Object} options options for configuring the middleware. See | ||
* {{#crossLink "Main/main"}}Main#main{{/crossLink}} for configuration | ||
* details. | ||
* @return {Function} a middleware function | ||
*/ | ||
module.exports = function(options) { | ||
@@ -7,0 +24,0 @@ var cipher = encryptor(options.herokuBouncerSecret); |
'use strict'; | ||
/** | ||
* @class Router | ||
*/ | ||
var OAuth = require('oauth').OAuth2; | ||
@@ -9,2 +13,11 @@ var encryptor = require('encryptor'); | ||
/** | ||
* Create a router with the necessary routes for Heroku OAuth authentication. | ||
* | ||
* @method main | ||
* @param {Object} options options for configuring the router. See | ||
* {{#crossLink "Main/main"}}Main#main{{/crossLink}} for configuration | ||
* details. | ||
* @return {Express.Router} an Express.js router | ||
*/ | ||
module.exports = function(options) { | ||
@@ -11,0 +24,0 @@ var cipher = encryptor(options.herokuBouncerSecret); |
{ | ||
"name": "heroku-bouncer", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "heroku bouncer middleware for express", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# node-heroku-bouncer | ||
node-heroku-bouncer is an easy-to-use module for adding Heroku OAuth | ||
authentication to express apps. | ||
authentication to express 4 apps. | ||
@@ -6,0 +6,0 @@ ## Install |
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
21818
581