How to use authenticate-pam - 5 common examples

To help you get started, we’ve selected a few authenticate-pam examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hexparrot / mineos-node / auth.js View on Github external
function pam(inner_callback) {
    // return true if error, false if auth failed, string for user if successful
    try {
      var pam = require('authenticate-pam');
    } catch (e) {
      inner_callback(true);
      return;
    }

    pam.authenticate(user, plaintext, function(err) {
      if (err)
        inner_callback(false);
      else
        inner_callback(user);
    })
  }
github magne4000 / node-jail / jail.js View on Github external
function jail(username, password){
    pam.authenticate(username, password, function(err) {
        if (!err) {
            console.log('User %s logged !', username);
            passwd.get(username, function(user){
                process.title = 'node-xplorer-jailed-'+username;
                try {
                    process.chdir(user.homedir);
                    posix.chroot(user.homedir);
                    process.setgid(parseInt(user.groupId, 10));
                    process.setuid(parseInt(user.userId, 10));
                    console.log('Subprocess successfully jailed by ' + username + ' ('+process.getuid()+':'+process.getgid()+')');
                    user.homedir = '/';
                    process.send({success: true, args:{user: user}});
                } catch (err) {
                    console.log(err);
                    process.send({success: false, eror: err});
                }
github os-js / OS.js / src / server / node / modules / auth / pam.js View on Github external
return new Promise((resolve, reject) => {
    _pam.authenticate(data.username, data.password, (err) => {
      if ( err ) {
        reject(err);
      } else {
        resolve({
          id: _userid.uid(data.username),
          username: data.username,
          name: data.username
        });
      }
    });
  });
};
github xcjs / blur-monitor / blurmonitor / services / auth / pam-auth-provider.js View on Github external
var promise = new Promise(function(resolve, reject) {
        pam.authenticate(username, password, function(err) {
            if(!err) {
                resolve(setToken(username));
            }
            else {
                reject(err);
            }
        });
    });
github brandonwamboldt / nodeftpd / auth / pam.js View on Github external
auth.register('pam', function (username, password, done) {
  pam.authenticate(username, password, function (err) {
    if (err) {
      done(err, null);
    } else {
      var user    = unix.getUser({ username: username })[0];
      user.chroot = config.auth.default_chroot === '~' ? user.home : config.auth.default_chroot;

      done(err, user);
    }
  });
});

authenticate-pam

Asynchronous PAM authentication for Node.JS

MIT
Latest version published 3 years ago

Package Health Score

42 / 100
Full package analysis

Popular authenticate-pam functions