Comparing version 0.1.16 to 0.1.17
@@ -166,7 +166,15 @@ /** | ||
* | ||
* Options: | ||
* - `pauseStream` Pause the request stream before deserializing the user | ||
* object from the session. Defaults to _false_. Should | ||
* be set to true in cases where middleware consuming the | ||
* request body is configured after passport and the | ||
* deserializeUser method is asynchronous. | ||
* | ||
* @param {Object} options | ||
* @return {Function} middleware | ||
* @api public | ||
*/ | ||
Passport.prototype.session = function() { | ||
return this.authenticate('session'); | ||
Passport.prototype.session = function(options) { | ||
return this.authenticate('session', options); | ||
} | ||
@@ -173,0 +181,0 @@ |
/** | ||
* Module dependencies. | ||
*/ | ||
var util = require('util') | ||
var pause = require('pause') | ||
, util = require('util') | ||
, Strategy = require('../strategy'); | ||
@@ -33,10 +34,17 @@ | ||
* @param {Object} req | ||
* @param {Object} options | ||
* @api protected | ||
*/ | ||
SessionStrategy.prototype.authenticate = function(req) { | ||
SessionStrategy.prototype.authenticate = function(req, options) { | ||
if (!req._passport) { return this.error(new Error('passport.initialize() middleware not in use')); } | ||
options = options || {}; | ||
var self = this | ||
, su = req._passport.session.user; | ||
if (su || su === 0) { | ||
// NOTE: Stream pausing is desirable in the case where later middleware is | ||
// listening for events emitted from request. For discussion on the | ||
// matter, refer to: https://github.com/jaredhanson/passport/pull/106 | ||
var paused = options.pauseStream ? pause(req) : null; | ||
req._passport.instance.deserializeUser(su, function(err, user) { | ||
@@ -46,3 +54,7 @@ if (err) { return self.error(err); } | ||
delete req._passport.session.user; | ||
return self.pass(); | ||
self.pass(); | ||
if (paused) { | ||
paused.resume(); | ||
} | ||
return; | ||
}; | ||
@@ -52,2 +64,5 @@ var property = req._passport.instance._userProperty || 'user'; | ||
self.pass(); | ||
if (paused) { | ||
paused.resume(); | ||
} | ||
}); | ||
@@ -54,0 +69,0 @@ } else { |
{ | ||
"name": "passport", | ||
"version": "0.1.16", | ||
"version": "0.1.17", | ||
"description": "Simple, unobtrusive authentication for Node.js.", | ||
@@ -25,3 +25,4 @@ "keywords": ["express", "connect", "auth", "authn", "authentication"], | ||
"dependencies": { | ||
"pkginfo": "0.2.x" | ||
"pkginfo": "0.2.x", | ||
"pause": "0.0.1" | ||
}, | ||
@@ -28,0 +29,0 @@ "devDependencies": { |
158
README.md
# Passport | ||
[http://passportjs.org](http://passportjs.org) | ||
Passport is an authentication framework for [Connect](http://senchalabs.github.com/connect/) | ||
and [Express](http://expressjs.com/), which is extensible through "plugins" | ||
known as _strategies_. | ||
Passport is [Express](http://expressjs.com/)-compatible authentication | ||
middleware for [Node.js](http://nodejs.org/). | ||
Passport is designed to be a general-purpose, yet simple, modular, and | ||
unobtrusive, authentication framework. Passport's sole purpose is to | ||
authenticate requests. In being modular, it doesn't force any particular | ||
authentication strategy on your application. In being unobtrusive, it doesn't | ||
mount routes in your application. The API is simple: you give Passport a | ||
request to authenticate, and Passport provides hooks for controlling what occurs | ||
when authentication succeeds or fails. | ||
Passport's sole purpose is to authenticate requests, which it does through an | ||
extensible set of plugins known as _strategies_. Passport does not mount | ||
routes or assume any particular database schema, which maximizes flexiblity and | ||
allows application-level decisions to be made by the developer. The API is | ||
simple: you provide Passport a request to authenticate, and Passport provides | ||
hooks for controlling what occurs when authentication succeeds or fails. | ||
@@ -29,4 +26,4 @@ ## Install | ||
Before asking passport to authenticate a request, the strategy (or strategies) | ||
used by an application must be configured. | ||
Before authenticating requests, the strategy (or strategies) used by an | ||
application must be configured. | ||
@@ -48,4 +45,4 @@ passport.use(new LocalStrategy( | ||
Passport does not impose any restrictions on how your user records are stored. | ||
Instead, you provide a function to Passport which implements the necessary | ||
serialization and deserialization logic. In typical applications, this will be | ||
Instead, you provide functions to Passport which implements the necessary | ||
serialization and deserialization logic. In a typical application, this will be | ||
as simple as serializing the user ID, and finding the user by ID when | ||
@@ -64,7 +61,7 @@ deserializing. | ||
#### Connect/Express Middleware | ||
#### Middleware | ||
To use Passport in a [Connect](http://senchalabs.github.com/connect/) or | ||
[Express](http://expressjs.com/)-based application, configure it with the | ||
required `passport.initialize()` middleware. If your applications uses | ||
To use Passport in an [Express](http://expressjs.com/) or | ||
[Connect](http://senchalabs.github.com/connect/)-based application, configure it | ||
with the required `passport.initialize()` middleware. If your application uses | ||
persistent login sessions (recommended, but not required), `passport.session()` | ||
@@ -74,2 +71,3 @@ middleware must also be used. | ||
app.configure(function() { | ||
app.use(express.static(__dirname + '/../../public')); | ||
app.use(express.cookieParser()); | ||
@@ -81,3 +79,2 @@ app.use(express.bodyParser()); | ||
app.use(app.router); | ||
app.use(express.static(__dirname + '/../../public')); | ||
}); | ||
@@ -87,7 +84,5 @@ | ||
Passport provides an `authenticate()` function (which is standard | ||
Connect/Express middleware), which is utilized to authenticate requests. | ||
Passport provides an `authenticate()` function, which is used as route | ||
middleware to authenticate requests. | ||
For example, it can be used as route middleware in an Express application: | ||
app.post('/login', | ||
@@ -102,95 +97,34 @@ passport.authenticate('local', { failureRedirect: '/login' }), | ||
For a complete, working example, refer to the [login example](https://github.com/jaredhanson/passport-local/tree/master/examples/login) | ||
included in [Passport-Local](https://github.com/jaredhanson/passport-local). | ||
included in [passport-local](https://github.com/jaredhanson/passport-local). | ||
## Strategies | ||
- [Local](https://github.com/jaredhanson/passport-local) (username and password) | ||
- [BrowserID](https://github.com/jaredhanson/passport-browserid) | ||
- [OpenID](https://github.com/jaredhanson/passport-openid) | ||
- [OAuth](https://github.com/jaredhanson/passport-oauth) (OAuth 1.0 and 2.0) | ||
- [SAML](https://github.com/bergie/passport-saml) by [Henri Bergius](https://github.com/bergie) | ||
- [WS-Federation + SAML 2.0](https://github.com/auth10/passport-wsfed-saml2) by [Auth10](https://github.com/auth10) | ||
- [WebID](https://github.com/magnetik/passport-webid) by [Baptiste Lafontaine](https://github.com/magnetik) | ||
- [23andMe](https://github.com/mowens/passport-23andme) by [Michael Owens](https://github.com/mowens) | ||
- [37signals](https://github.com/jaredhanson/passport-37signals) | ||
- [500px](https://github.com/jeremybenaim/passport-500px) by [Jeremy Benaim](https://github.com/jeremybenaim) | ||
- [AngelList](https://github.com/jaredhanson/passport-angellist) | ||
- [AOL](https://github.com/jaredhanson/passport-aol) | ||
- [App.net](https://github.com/mowens/passport-appdotnet) by [Michael Owens](https://github.com/mowens) | ||
- [Bitbucket](https://github.com/jaredhanson/passport-bitbucket) | ||
- [Buffer](https://github.com/despekiroule/passport-bufferapp) by [Sébastien De Bollivier](https://github.com/despekiroule) | ||
- [DailyCred](https://github.com/hstove/passport-dailycred) by [Hank Stoever](https://github.com/hstove) | ||
- [Digg](https://github.com/jaredhanson/passport-digg) | ||
- [doctape](https://github.com/doctape/passport-doctape) | ||
- [Dropbox](https://github.com/jaredhanson/passport-dropbox) | ||
- [Dwolla](https://github.com/jaredhanson/passport-dwolla) | ||
- [Evernote](https://github.com/jaredhanson/passport-evernote) | ||
- [Facebook](https://github.com/jaredhanson/passport-facebook) | ||
- [FamilySearch](https://github.com/jaredhanson/passport-familysearch) | ||
- [Fitbit](https://github.com/jaredhanson/passport-fitbit) | ||
- [Flattr](https://github.com/freenerd/passport-flattr) by [Johan Uhle](https://github.com/freenerd) | ||
- [Flickr](https://github.com/johnnyhalife/passport-flickr) by [Johnny Halife](https://github.com/johnnyhalife) | ||
- [Force.com](https://github.com/joshbirk/passport-forcedotcom) (Salesforce, Database.com) by [Joshua Birk](https://github.com/joshbirk) | ||
- [Foursquare](https://github.com/jaredhanson/passport-foursquare) | ||
- [FreedomWorks](https://github.com/carlos8f/passport-freedomworks) by [Carlos Rodriguez](https://github.com/carlos8f) | ||
- [Geeklist](https://github.com/despekiroule/passport-geeklist) by [Sébastien De Bollivier](https://github.com/despekiroule) | ||
- [Geoloqi](https://github.com/jaredhanson/passport-geoloqi) | ||
- [GitHub](https://github.com/jaredhanson/passport-github) | ||
- [Goodreads](https://github.com/jaredhanson/passport-goodreads) | ||
- [Google](https://github.com/jaredhanson/passport-google) (OpenID) | ||
- [Google](https://github.com/jaredhanson/passport-google-oauth) (OAuth 1.0 and 2.0) | ||
- [Gowalla](https://github.com/jaredhanson/passport-gowalla) | ||
- [HackID](https://github.com/HackBerkeley/passport-hackid) by [Hackers @ Berkeley](https://github.com/HackBerkeley) | ||
- [Instagram](https://github.com/jaredhanson/passport-instagram) | ||
- [Intuit](https://github.com/jaredhanson/passport-intuit) (OpenID) | ||
- [Intuit](https://github.com/jaredhanson/passport-intuit-oauth) (OAuth 1.0) | ||
- [Justin.tv](https://github.com/jaredhanson/passport-justintv) | ||
- [LinkedIn](https://github.com/jaredhanson/passport-linkedin) | ||
- [me2day](https://github.com/outsideris/passport-me2day) by [JeongHoon Byun](https://github.com/outsideris) | ||
- [Meetup](https://github.com/jaredhanson/passport-meetup) | ||
- [Netflix](https://github.com/jaredhanson/passport-netflix) | ||
- [Odnoklassniki](https://github.com/ozon1234/passport-odnoklassniki) by [Alexey Kozlov](https://github.com/ozon1234) | ||
- [Ohloh](https://github.com/jaredhanson/passport-ohloh) | ||
- [OpenStreetMap](https://github.com/jaredhanson/passport-openstreetmap) | ||
- [PayPal](https://github.com/jaredhanson/passport-paypal) (OpenID) | ||
- [PayPal](https://github.com/jaredhanson/passport-paypal-oauth) (OAuth 2.0) | ||
- [picplz](https://github.com/jaredhanson/passport-picplz) | ||
- [Rdio](https://github.com/jaredhanson/passport-rdio) | ||
- [Readability](https://github.com/jaredhanson/passport-readability) | ||
- [RunKeeper](https://github.com/jaredhanson/passport-runkeeper) | ||
- [SmugMug](https://github.com/jaredhanson/passport-smugmug) | ||
- [SharePoint](https://github.com/QuePort/passport-sharepoint) by [QuePort](https://github.com/QuePort) | ||
- [SoundCloud](https://github.com/jaredhanson/passport-soundcloud) | ||
- [StatusNet](https://github.com/zoowar/passport-statusnet) by [ZooWar](https://github.com/zoowar) | ||
- [Steam](https://github.com/liamcurry/passport-steam) by [Liam Curry](https://github.com/liamcurry) | ||
- [SUPINFO](https://github.com/godezinc/passport-supinfo) by [Vincent PEYROUSE](https://github.com/GodezInc) | ||
- [Trade Me](https://github.com/Tumunu/passport-trademe) by [Tumunu](https://github.com/Tumunu) | ||
- [TripIt](https://github.com/jaredhanson/passport-tripit) | ||
- [Tumblr](https://github.com/jaredhanson/passport-tumblr) | ||
- [Twitter](https://github.com/jaredhanson/passport-twitter) | ||
- [TxSSC](https://github.com/TxSSC/passport-txssc) by [Texas School Safety Center](https://github.com/TxSSC) | ||
- [Urlship](https://github.com/urlship/passport-urlship) by [Urlship](https://github.com/urlship) | ||
- [Vimeo](https://github.com/jaredhanson/passport-vimeo) | ||
- [VKontakte](https://github.com/stevebest/passport-vkontakte) by [Stepan Stolyarov](https://github.com/stevebest) | ||
- [Windows Live](https://github.com/jaredhanson/passport-windowslive) | ||
- [Withings](https://github.com/mowens/passport-withings) by [Michael Owens](https://github.com/mowens) | ||
- [Yahoo!](https://github.com/jaredhanson/passport-yahoo) (OpenID) | ||
- [Yahoo!](https://github.com/jaredhanson/passport-yahoo-oauth) (OAuth 1.0) | ||
- [Yammer](https://github.com/jaredhanson/passport-yammer) | ||
- [Yandex](https://github.com/gurugray/passport-yandex) by [Sergey Sergeev](https://github.com/gurugray) | ||
- [Atlassian Crowd](https://bitbucket.org/knecht_andreas/passport-atlassian-crowd) by [Andreas Knecht](https://bitbucket.org/knecht_andreas) | ||
- [OpenSSO](https://github.com/oroce/passport-opensso) by [Róbert Oroszi](https://github.com/oroce) | ||
- [OpenAM](https://github.com/alesium/passport-openam) by [Alesium](https://github.com/alesium) | ||
- [Drupal](https://github.com/mixmarket/passport-drupal) by [Victor Kareh](https://github.com/vkareh) (for Drupal-powered sites using [OAuth Login Provider](http://drupal.org/project/oauthloginprovider) module) | ||
- [HTTP](https://github.com/jaredhanson/passport-http) (HTTP Basic and Digest schemes) | ||
- [HTTP-Bearer](https://github.com/jaredhanson/passport-http-bearer) (HTTP Bearer scheme) | ||
- [HTTP-OAuth](https://github.com/jaredhanson/passport-http-oauth) (HTTP OAuth scheme) | ||
- [OAuth2-Client-Password](https://github.com/jaredhanson/passport-oauth2-client-password) (OAuth 2.0 client password) | ||
- [Hash](https://github.com/yuri-karadzhov/passport-hash) (hash parameter) by [Yuri Karadzhov](https://github.com/yuri-karadzhov) | ||
- [Anonymous](https://github.com/jaredhanson/passport-anonymous) | ||
- [Dummy](https://github.com/developmentseed/passport-dummy) by [Development Seed](https://github.com/developmentseed) | ||
Passport has a comprehensive set of **over 120** authentication strategies | ||
covering social networking, enterprise integration, API services, and more. | ||
The [complete list](https://github.com/jaredhanson/passport/wiki/Strategies) is | ||
available on the [wiki](https://github.com/jaredhanson/passport/wiki). | ||
**Attention Developers:** If you implement a new authentication strategy for | ||
Passport, send me a message and I will update the list. | ||
The following table lists commonly used strategies: | ||
|Strategy | Protocol |Developer | | ||
|---------------------------------------------------------------|--------------------------|------------------------------------------------| | ||
|[Local](https://github.com/jaredhanson/passport-local) | HTML form |[Jared Hanson](https://github.com/jaredhanson) | | ||
|[OpenID](https://github.com/jaredhanson/passport-openid) | OpenID |[Jared Hanson](https://github.com/jaredhanson) | | ||
|[BrowserID](https://github.com/jaredhanson/passport-browserid) | BrowserID |[Jared Hanson](https://github.com/jaredhanson) | | ||
|[Facebook](https://github.com/jaredhanson/passport-facebook) | OAuth 2.0 |[Jared Hanson](https://github.com/jaredhanson) | | ||
|[Google](https://github.com/jaredhanson/passport-google) | OpenID |[Jared Hanson](https://github.com/jaredhanson) | | ||
|[Google](https://github.com/jaredhanson/passport-google-oauth) | OAuth / OAuth 2.0 |[Jared Hanson](https://github.com/jaredhanson) | | ||
|[Twitter](https://github.com/jaredhanson/passport-twitter) | OAuth |[Jared Hanson](https://github.com/jaredhanson) | | ||
## Related Modules | ||
- [Locomotive](https://github.com/jaredhanson/locomotive) — Powerful MVC web framework | ||
- [OAuthorize](https://github.com/jaredhanson/oauthorize) — OAuth service provider toolkit | ||
- [OAuth2orize](https://github.com/jaredhanson/oauth2orize) — OAuth 2.0 authorization server toolkit | ||
- [connect-ensure-login](https://github.com/jaredhanson/connect-ensure-login) — middleware to ensure login sessions | ||
The [modules](https://github.com/jaredhanson/passport/wiki/Modules) page on the | ||
[wiki](https://github.com/jaredhanson/passport/wiki) lists other useful modules | ||
that build upon or integrate with Passport. | ||
## Tests | ||
@@ -197,0 +131,0 @@ |
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
982
39264
2
139
+ Addedpause@0.0.1
+ Addedpause@0.0.1(transitive)