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.3.2 to 0.4.0

.npmignore

14

lib/authenticator.js
/**
* Module dependencies.
*/
var SessionStrategy = require('./strategies/session');
var SessionStrategy = require('./strategies/session')
, SessionManager = require('./sessionmanager');

@@ -31,3 +32,4 @@

this.framework(require('./framework/connect')());
this.use(new SessionStrategy());
this.use(new SessionStrategy(this.deserializeUser.bind(this)));
this._sm = new SessionManager({ key: this._key }, this.serializeUser.bind(this));
};

@@ -235,2 +237,10 @@

// TODO: Make session manager pluggable
/*
Authenticator.prototype.sessionManager = function(mgr) {
this._sm = mgr;
return this;
}
*/
/**

@@ -237,0 +247,0 @@ * Registers a function used to serialize user objects into the session.

9

lib/errors/authenticationerror.js
/**
* `AuthenticationError` error.
*
* @constructor
* @api private

@@ -14,11 +15,7 @@ */

/**
* Inherit from `Error`.
*/
// Inherit from `Error`.
AuthenticationError.prototype.__proto__ = Error.prototype;
/**
* Expose `AuthenticationError`.
*/
// Expose constructor.
module.exports = AuthenticationError;

@@ -11,3 +11,3 @@ /**

/**
* Intiate a login session for `user`.
* Initiate a login session for `user`.
*

@@ -51,12 +51,4 @@ * Options:

var self = this;
this._passport.instance.serializeUser(user, this, function(err, obj) {
this._passport.instance._sm.logIn(this, user, function(err) {
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();

@@ -82,4 +74,4 @@ });

this[property] = null;
if (this._passport && this._passport.session) {
delete this._passport.session.user;
if (this._passport) {
this._passport.instance._sm.logOut(this);
}

@@ -86,0 +78,0 @@ };

@@ -21,6 +21,16 @@ /**

* - `successRedirect` After successful login, redirect to given URL
* - `successMessage` True to store success message in
* req.session.messages, or a string to use as override
* message for success.
* - `successFlash` True to flash success messages or a string to use as a flash
* message for success (overrides any from the strategy itself).
* - `failureRedirect` After failed login, redirect to given URL
* - `failureMessage` True to store failure message in
* req.session.messages, or a string to use as override
* message for failure.
* - `failureFlash` True to flash failure messages or a string to use as a flash
* message for failures (overrides any from the strategy itself).
* - `assignProperty` Assign the object provided by the verify callback to given property
*
* An optional `callback` can be supplied to allow the application to overrride
* An optional `callback` can be supplied to allow the application to override
* the default manner in which authentication attempts are handled. The

@@ -30,6 +40,9 @@ * callback has the following signature, where `user` will be set to the

* otherwise. An optional `info` argument will be passed, containing additional
* details provided by the strategy's verify callback.
* details provided by the strategy's verify callback - this could be information about
* a successful authentication or a challenge message for a failed authentication.
* An optional `status` argument will be passed when authentication fails - this could
* be a HTTP response code for a remote authentication failure or similar.
*
* app.get('/protected', function(req, res, next) {
* passport.authenticate('local', function(err, user, info) {
* passport.authenticate('local', function(err, user, info, status) {
* if (err) { return next(err) }

@@ -36,0 +49,0 @@ * if (!user) { return res.redirect('/signin') }

@@ -14,5 +14,12 @@ /**

*/
function SessionStrategy() {
function SessionStrategy(options, deserializeUser) {
if (typeof options == 'function') {
deserializeUser = options;
options = undefined;
}
options = options || {};
Strategy.call(this);
this.name = 'session';
this._deserializeUser = deserializeUser;
}

@@ -54,14 +61,11 @@

var paused = options.pauseStream ? pause(req) : null;
req._passport.instance.deserializeUser(su, req, function(err, user) {
this._deserializeUser(su, req, function(err, user) {
if (err) { return self.error(err); }
if (!user) {
delete req._passport.session.user;
self.pass();
if (paused) {
paused.resume();
}
return;
} else {
// TODO: Remove instance access
var property = req._passport.instance._userProperty || 'user';
req[property] = user;
}
var property = req._passport.instance._userProperty || 'user';
req[property] = user;
self.pass();

@@ -68,0 +72,0 @@ if (paused) {

{
"name": "passport",
"version": "0.3.2",
"version": "0.4.0",
"description": "Simple, unobtrusive authentication for Node.js.",

@@ -29,3 +29,3 @@ "keywords": [

"type": "MIT",
"url": "http://www.opensource.org/licenses/MIT"
"url": "http://opensource.org/licenses/MIT"
}

@@ -39,2 +39,3 @@ ],

"devDependencies": {
"make-node": "0.3.x",
"mocha": "2.x.x",

@@ -44,3 +45,3 @@ "chai": "2.x.x",

"chai-passport-strategy": "0.2.x",
"proxyquire": "1.x.x"
"proxyquire": "1.4.x"
},

@@ -53,2 +54,2 @@ "engines": {

}
}
}
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