Socket
Socket
Sign inDemoInstall

passport

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

passport - npm Package Compare versions

Comparing version 0.1.5 to 0.1.6

17

lib/passport/http/request.js

@@ -37,9 +37,10 @@ /**

options = options || {};
var property = this._passport.instance._userProperty || 'user';
var session = (options.session === undefined) ? true : options.session;
this.user = user;
this[property] = user;
if (session) {
var self = this;
this._passport.instance.serializeUser(user, function(err, obj) {
if (err) { self.user = null; return done(err); }
if (err) { self[property] = null; return done(err); }
self._passport.session.user = obj;

@@ -61,3 +62,6 @@ done();

if (!this._passport) throw new Error('passport.initialize() middleware not in use');
this.user = null;
var property = this._passport.instance._userProperty || 'user';
this[property] = null;
delete this._passport.session.user;

@@ -73,3 +77,8 @@ };

req.isAuthenticated = function() {
return (this.user) ? true : false;
var property = 'user';
if (this._passport && this._passport.instance._userProperty) {
property = this._passport.instance._userProperty;
}
return (this[property]) ? true : false;
};

@@ -76,0 +85,0 @@

@@ -24,2 +24,4 @@ /**

this._userProperty = 'user';
this.use(new SessionStrategy());

@@ -60,2 +62,5 @@ };

*
* Options:
* - `userProperty` Property to set on `req` upon login, defaults to _user_
*
* Examples:

@@ -67,6 +72,14 @@ *

*
* app.configure(function() {
* app.use(passport.initialize({ userProperty: 'currentUser' }));
* });
*
* @param {Object} options
* @return {Function} middleware
* @api public
*/
Passport.prototype.initialize = function() {
Passport.prototype.initialize = function(options) {
options = options || {};
this._userProperty = options.userProperty || 'user';
return initialize().bind(this);

@@ -161,7 +174,7 @@ }

*/
Passport.prototype.authorize = function(strategy, options) {
Passport.prototype.authorize = function(strategy, options, callback) {
options = options || {};
options.assignProperty = 'account';
return authenticate(strategy, options).bind(this);
return authenticate(strategy, options, callback).bind(this);
}

@@ -277,3 +290,3 @@

*/
exports.version = '0.1.5';
require('pkginfo')(module, 'version');

@@ -280,0 +293,0 @@ /**

@@ -54,3 +54,3 @@ /**

req._passport.instance = passport;
//console.log('!! session: ' + util.inspect(req.session));

@@ -57,0 +57,0 @@

@@ -42,3 +42,4 @@ /**

if (err) { return self.error(err); }
req.user = user;
var property = req._passport.instance._userProperty || 'user';
req[property] = user;
self.pass();

@@ -45,0 +46,0 @@ });

{
"name": "passport",
"version": "0.1.5",
"version": "0.1.6",
"description": "Simple, unobtrusive authentication for Node.js.",
"author": "Jared Hanson <jaredhanson@gmail.com> (http://www.jaredhanson.net/)",
"author": { "name": "Jared Hanson", "email": "jaredhanson@gmail.com", "url": "http://www.jaredhanson.net/" },
"homepage": "http://passportjs.org/",
"repository": {
"type": "git",
"url": "http://github.com/jaredhanson/passport.git"
"url": "git://github.com/jaredhanson/passport.git"
},
"bugs": {
"url": "http://github.com/jaredhanson/passport/issues"
},
"main": "./lib/passport",
"dependencies": {
"pkginfo": "0.2.x"
},
"devDependencies": {
"vows": "0.6.x"
},
"engines": { "node": ">= 0.4.0" },
"licenses": [ {
"type": "MIT",
"url": "http://www.opensource.org/licenses/MIT"
} ],
"keywords": ["express", "connect", "auth", "authn", "authentication"]
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc