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.3 to 0.1.4

29

lib/passport/index.js

@@ -139,2 +139,29 @@ /**

/**
* Middleware that will authorize a third-party account using the given
* `strategy` name, with optional `options`.
*
* If authorization is successful, the result provided by the strategy's verify
* callback will be assigned to `req.account`. The existing login session and
* `req.user` will be unaffected.
*
* This function is particularly useful when connecting third-party accounts
* to the local account of a user that is currently authenticated.
*
* Examples:
*
* passport.authorize('twitter-authz', { failureRedirect: '/account' });
*
* @param {String} strategy
* @param {Object} options
* @return {Function} middleware
* @api public
*/
Passport.prototype.authorize = function(strategy, options) {
options = options || {};
options.assignProperty = 'account';
return authenticate(strategy, options, callback).bind(this);
}
/**
* Registers a function used to serialize user objects into the session.

@@ -247,3 +274,3 @@ *

*/
exports.version = '0.1.3';
exports.version = '0.1.4';

@@ -250,0 +277,0 @@ /**

14

lib/passport/middleware/authenticate.js

@@ -22,2 +22,3 @@ /**

* - `failureRedirect` After failed login, redirect to given URL
* - `assignProperty` Assign the object provided by the verify callback to given property
*

@@ -32,6 +33,8 @@ * An optional `callback` can be supplied to allow the application to overrride

*
* passport.authenticate('local', function(err, user, profile) {
* if (err) { return next(err) }
* if (!user) { return res.redirect('/signin') }
* res.redirect('/account');
* app.get('/protected', function(req, res, next) {
* passport.authenticate('local', function(err, user, profile) {
* if (err) { return next(err) }
* if (!user) { return res.redirect('/signin') }
* res.redirect('/account');
* })(req, res, next);
* });

@@ -72,2 +75,5 @@ *

return callback(null, user, profile);
} else if (options.assignProperty) {
req[options.assignProperty] = user;
return next();
}

@@ -74,0 +80,0 @@

{
"name": "passport",
"version": "0.1.3",
"description": "Authentication framework for Connect and Express.",
"version": "0.1.4",
"description": "Simple, unobtrusive authentication for Node.js.",
"author": "Jared Hanson <jaredhanson@gmail.com> (http://www.jaredhanson.net/)",

@@ -6,0 +6,0 @@ "repository": {

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