+6
-12
@@ -119,9 +119,5 @@ /** | ||
| * | ||
| * app.configure(function() { | ||
| * app.use(passport.initialize()); | ||
| * }); | ||
| * app.use(passport.initialize()); | ||
| * | ||
| * app.configure(function() { | ||
| * app.use(passport.initialize({ userProperty: 'currentUser' })); | ||
| * }); | ||
| * app.use(passport.initialize({ userProperty: 'currentUser' })); | ||
| * | ||
@@ -219,8 +215,6 @@ * @param {Object} options | ||
| * | ||
| * app.configure(function() { | ||
| * app.use(connect.cookieParser()); | ||
| * app.use(connect.session({ secret: 'keyboard cat' })); | ||
| * app.use(passport.initialize()); | ||
| * app.use(passport.session()); | ||
| * }); | ||
| * app.use(connect.cookieParser()); | ||
| * app.use(connect.session({ secret: 'keyboard cat' })); | ||
| * app.use(passport.initialize()); | ||
| * app.use(passport.session()); | ||
| * | ||
@@ -227,0 +221,0 @@ * Options: |
@@ -50,3 +50,10 @@ /** | ||
| if (err) { self[property] = null; return done(err); } | ||
| if (!self._passport.session) { | ||
| self._passport.session = {}; | ||
| } | ||
| self._passport.session.user = obj; | ||
| if (!self.session) { | ||
| self.session = {}; | ||
| } | ||
| self.session[self._passport.instance._key] = self._passport.session; | ||
| done(); | ||
@@ -53,0 +60,0 @@ }); |
@@ -24,8 +24,6 @@ /** | ||
| * | ||
| * app.configure(function() { | ||
| * app.use(connect.cookieParser()); | ||
| * app.use(connect.session({ secret: 'keyboard cat' })); | ||
| * app.use(passport.initialize()); | ||
| * app.use(passport.session()); | ||
| * }); | ||
| * app.use(connect.cookieParser()); | ||
| * app.use(connect.session({ secret: 'keyboard cat' })); | ||
| * app.use(passport.initialize()); | ||
| * app.use(passport.session()); | ||
| * | ||
@@ -54,13 +52,6 @@ * passport.serializeUser(function(user, done) { | ||
| req._passport.session = req.session[passport._key]; | ||
| } else if (req.session) { | ||
| // initialize new session | ||
| req.session[passport._key] = {}; | ||
| req._passport.session = req.session[passport._key]; | ||
| } else { | ||
| // no session is available | ||
| req._passport.session = {}; | ||
| } | ||
| next(); | ||
| }; | ||
| }; |
@@ -41,4 +41,8 @@ /** | ||
| var self = this | ||
| , su = req._passport.session.user; | ||
| var self = this, | ||
| su; | ||
| if (req._passport.session) { | ||
| su = req._passport.session.user; | ||
| } | ||
| if (su || su === 0) { | ||
@@ -45,0 +49,0 @@ // NOTE: Stream pausing is desirable in the case where later middleware is |
+2
-2
| { | ||
| "name": "passport", | ||
| "version": "0.2.2", | ||
| "version": "0.3.0", | ||
| "description": "Simple, unobtrusive authentication for Node.js.", | ||
@@ -50,2 +50,2 @@ "keywords": [ | ||
| } | ||
| } | ||
| } |
+10
-12
@@ -17,3 +17,3 @@ [](http://passportjs.org) | ||
| extensible set of plugins known as _strategies_. Passport does not mount | ||
| routes or assume any particular database schema, which maximizes flexiblity and | ||
| routes or assume any particular database schema, which maximizes flexibility and | ||
| allows application-level decisions to be made by the developer. The API is | ||
@@ -82,11 +82,9 @@ simple: you provide Passport a request to authenticate, and Passport provides | ||
| app.configure(function() { | ||
| app.use(express.static(__dirname + '/../../public')); | ||
| app.use(express.cookieParser()); | ||
| app.use(express.bodyParser()); | ||
| app.use(express.session({ secret: 'keyboard cat' })); | ||
| app.use(passport.initialize()); | ||
| app.use(passport.session()); | ||
| app.use(app.router); | ||
| }); | ||
| var app = express(); | ||
| app.use(require('serve-static')(__dirname + '/../../public')); | ||
| app.use(require('cookie-parser')()); | ||
| app.use(require('body-parser').urlencoded({ extended: true })); | ||
| app.use(require('express-session')({ secret: 'keyboard cat', resave: true, saveUninitialized: true })); | ||
| app.use(passport.initialize()); | ||
| app.use(passport.session()); | ||
@@ -127,4 +125,4 @@ #### Authenticate Requests | ||
| - 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). | ||
| - For a complete, working example, refer to the [example](https://github.com/passport/express-4.x-local-example) | ||
| that uses [passport-local](https://github.com/jaredhanson/passport-local). | ||
| - **Local Strategy**: Refer to the following tutorials for setting up user authentication via LocalStrategy (`passport-local`) | ||
@@ -131,0 +129,0 @@ - Express v3x - [Tutorial](http://mherman.org/blog/2013/11/11/user-authentication-with-passport-dot-js/) / [working example](https://github.com/mjhea0/passport-local) |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
43079
-0.37%1014
-0.49%160
-1.23%