Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cantina-auth

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cantina-auth

Authentication base plugin for Cantina

  • 4.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

cantina-auth

Wraps passport to provde authentication for your cantina application.

Dependencies

  • Session middleware provided by cantina-session

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.

FAQs

Package last updated on 25 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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