8000 GitHub - rbaumier/passport-session: Username and password authentication strategy for Passport and Node.js depending on a session.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Username and password authentication strategy for Passport and Node.js depending on a session.

License

Notifications You must be signed in to change notification settings

rbaumier/passport-session

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

passport-session

Install

$ npm install passport-session

Usage

It is the same as passport-local but with a sessionId. It allow you to authenticate your users on differents sessions (or "rooms").

Configure Strategy

passport.use(new LocalStrategy(
  function(email, password, sessionId, done) {
    User.findOne({ email: email, sessionId: sessionId }, function (err, user) {
      if (err) { return done(err); }
      if (!user) { return done(null, false); }
      if (!user.verifyPassword(password)) { return done(null, false); }
      return done(null, user);
    });
  }
));
Available Options

This strategy takes an optional options hash before the function, e.g. new LocalStrategy({/* options */, callback}).

The available options are:

  • emailField - Optional, defaults to 'email'
  • passwordField - Optional, defaults to 'password'
  • sessionIdField - Optional, defaults to 'sessionId'

This fields define the name of the properties in the POST body that are sent to the server.

About

Username and password authentication strategy for Passport and Node.js depending on a session.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Makefile 51.4%
  • JavaScript 48.6%
0