4.1.3 • Published 7 years ago

cantina-auth v4.1.3

Weekly downloads
9
License
-
Repository
github
Last release
7 years ago

cantina-auth

Wraps passport to provde authentication for your cantina application.

Dependencies

Provides

  • app.passport - An initialized passport instance.

Adds Middleware

  • extendRequest() - Adds: req.logIn, req.logOut, req.isAuthenticated, req.isUnauthenticated, res.redirect(location, status)
  • passport.initialize()
  • passport.session()
  • GET '/logout' - Route handler to log a user out.

Configuration

  • logoutPath: The path that should log a user out.
  • logoutRedirect: The path a logged-out user should be redirected to.

Defaults

{
  logoutPath: '/logout',
  logoutRedirect: '/'
}

Usage

Your application MUST provide handlers for serializing and deserializing users.

  • app.serializeUser (user) - Returns a user's id.
  • auth:deserialize (id, cb) - Should load user and call cb with (err, user)

Example

var app = require('cantina').createApp();

app.boot(function (err) {
  if (err) throw err;

  app.serializeUser = function (user) {
    return user.id;
  };
  app.deserializeUser = function(id, done) {
    loadUser(id, function(err, user) {
      done(err, user);
    });
  };

  app.require('cantina-web');
  app.require('cantina-auth');

  app.start();
});

Developed by Terra Eclipse

Terra Eclipse, Inc. is a nationally recognized political technology and strategy firm located in Santa Cruz, CA and Washington, D.C.

4.1.3

7 years ago

3.0.1

7 years ago

3.0.0

7 years ago

4.1.2

10 years ago

4.1.1

10 years ago