diff options
| author | Kumar Damani <kumar.damani@mail.utoronto.ca> | 2019-04-16 13:17:06 +0000 |
|---|---|---|
| committer | Kumar Damani <kumar.damani@mail.utoronto.ca> | 2019-04-16 13:17:06 +0000 |
| commit | dc46b87abee1e441c07524ddde67fd902a919336 (patch) | |
| tree | 13eba08b8655dfd78e9600ec5f612011a0bf3b35 /node_modules/passport/lib/strategies/session.js | |
| parent | 26f4b38e9e5a202756a7c33abc775aea2617aeaf (diff) | |
added some dependencies to package.json
Diffstat (limited to 'node_modules/passport/lib/strategies/session.js')
| -rw-r--r-- | node_modules/passport/lib/strategies/session.js | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/node_modules/passport/lib/strategies/session.js b/node_modules/passport/lib/strategies/session.js deleted file mode 100644 index f2db338..0000000 --- a/node_modules/passport/lib/strategies/session.js +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Module dependencies. - */ -var pause = require('pause') - , util = require('util') - , Strategy = require('passport-strategy'); - - -/** - * `SessionStrategy` constructor. - * - * @api public - */ -function SessionStrategy() { - Strategy.call(this); - this.name = 'session'; -} - -/** - * Inherit from `Strategy`. - */ -util.inherits(SessionStrategy, Strategy); - -/** - * Authenticate request based on the current session state. - * - * The session authentication strategy uses the session to restore any login - * state across requests. If a login session has been established, `req.user` - * will be populated with the current user. - * - * This strategy is registered automatically by Passport. - * - * @param {Object} req - * @param {Object} options - * @api protected - */ -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; - if (req._passport.session) { - 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, req, function(err, user) { - if (err) { return self.error(err); } - if (!user) { - delete req._passport.session.user; - self.pass(); - if (paused) { - paused.resume(); - } - return; - } - var property = req._passport.instance._userProperty || 'user'; - req[property] = user; - self.pass(); - if (paused) { - paused.resume(); - } - }); - } else { - self.pass(); - } -}; - - -/** - * Expose `SessionStrategy`. - */ -module.exports = SessionStrategy; |
