passport-assistant

A module that helps your to manage AAA with passport.

npm install passport-assistant
2 downloads in the last week
4 downloads in the last month

passport-assistant

UNSTABLE...

This module is desined to help you with AAA and passport.js.

Features:

  • Middleware for interacting with passport.js
  • Passport account management.
  • Supports automatic hashing of account passwords.
  • Supports reversable password encryption for authentication methods requiring the original password.

Other Modules:

  • passport-assistant-kerberos - A module for adding Kerberos support.

Installing

npm install passport-assistant

Configuration

var PassportAssistant = require('passport-assistant')
var settings = {}
var assistant = new PassportAssistant(settings)

Using Middleware

var kerberos = require('passport-assistant-kerberos')
var kerberosSettings = {
  defaultRealm: 'EXAMPLE.COM',
  upperCaseRealms: true,
  allowedRealms: ["EXAMPLE.COM"], // When enabled only these realms are allowed.
  restrictRealms: false, 
}
assistant.use(new kerberos(kerberosSettings))

passport.use(new BasicStrategy({}, assistant.Kerberos.KerberosStrategy))

Accounts

These methods are used to manage accounts on your system.

createAccount(strategy, account, password, who, done)

  • strategy
  • account
  • password
  • who
  • function(err, id){}

Create a new account using the strategy name provided. The strategy will select the middleware required. When no middleware matches the create account event will be emitted. The account argument should be the name of the account. The password should be in plain text. This module will hash it by default. The who argument is used for accounting records. You can set this to the account name of who or what is creating the account.

The last item is a callback that can be called to notify you if the middleware succeeded. The id field should match the accounts new id.

Event: 'create account'

  • account
  • password
  • function(err, id) {}

Emitted after the createAccount method is called if none of the configured middleware can handle the requested. The password object will be hashed automatically if the passwords.lastResortHashThePasswords setting is true.

The last item is a callback that can be called to notify the application if the account creation succeeded. The id field should match the accounts id.

deleteAccount(strategy, account, who, done)

  • strategy
  • account
  • who
  • function(err){}

Delete an account using the strategy name provided. The strategy will select the middleware required. When no middleware matches the delete account event will be emitted. The account argument should be the name of the account. The who argument is used for accounting records. You can set this to the account name of who or what is creating the account.

The last item is a callback that can be called to notify you if the middleware succeeded. The id field should match the id of the account just deleted.

Accounting Messages

Accounting events are emitted to the accounting event. You can handle them any way you choose.

Example

// Collecting accounting messages. 
assistant.on('accounting', function(message){
  console.log('Accounting:', message)
})
npm loves you