passport-adkoa

1.4.0 • Public • Published

passport-adkoa

This is simple PassportJS strategy for NTLM auth in Active Directory Domain.

It's modified to using with KoaJs by Hervé de CHAVIGNY

Active Directory support is heavily inspired by express-ntlm.

Installation

npm i passport-adkoa --save

Basic Usage

Without session

const PassportStrategy = require('passport-adkoa');

passport.use(new PassportStrategy({
    domain: process.env.DOMAIN,
    domaincontroller: process.env.DOMAINCONTROLLER
}, function(user, verified) {
    return verified(null, user, null);
}));

app.use(passport.initialize({session: false}));
app.use(passport.authenticate('ntlm', {session: false}));

With session

app.use(session({
    secret: 'test-passport-ad',
    resave: true,
    saveUninitialized: true
}));

passport.use(new NtlmStrategy({
    domain: process.env.DOMAIN,
    domaincontroller: process.env.DOMAINCONTROLLER,
    domainuser: {
        user: process.env.USER,
        pass: process.env.PSWD
    },
    session: true,
    ttl: 1000
}, function(user, verified) {

    return verified(null, user, null);
}));

app.use(passport.initialize({session: false}));
app.use(passport.authenticate('ntlm', {session: false}));

Options

  • domain - domain name
  • domaincontroller - ldap url for domain controller
  • ttl - msec to store unused credentials.
  • domainuser.user - domain user
  • domainuser.user - domain user
  • session - is use session for store credentials

If a domainuser is specified, then this user will be prompted for a domain for extended information.

Package Sidebar

Install

npm i passport-adkoa

Weekly Downloads

242

Version

1.4.0

License

MIT

Unpacked Size

31.9 kB

Total Files

15

Last publish

Collaborators

  • vevedh