Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate LDAP #1

Open
gsf opened this issue Aug 13, 2013 · 4 comments
Open

Integrate LDAP #1

gsf opened this issue Aug 13, 2013 · 4 comments

Comments

@gsf
Copy link
Member

gsf commented Aug 13, 2013

So hey we got some LDAP working with a node.js library:

var ldap = require('ldapjs'); 
var client = ldap.createClient({ 
  url: 'ldaps://ldap.mariposa.coop/' 
}); 

var opts = { 
  scope: 'sub' 
}; 

// Only need to bind for setting and deleting 
//client.bind('cn=admin,dc=ldap,dc=mariposa,dc=coop', 'password', function (err) { 
//  if (err) throw err; 

client.search('ou=people,dc=ldap,dc=mariposa,dc=coop', opts, function(err, res) { 
  if (err) throw err; 

  res.on('searchEntry', function(entry) { 
    console.log('entry: ' + JSON.stringify(entry.object)); 
  }); 
  res.on('searchReference', function(referral) { 
    console.log('referral: ' + referral.uris.join()); 
  }); 
  res.on('error', function(err) { 
    console.error('error: ' + err.message); 
  }); 
  res.on('end', function(result) { 
    console.log('status: ' + result.status); 
    process.exit(); 
  }); 
}); 

//});
@tmmagee
Copy link

tmmagee commented Aug 13, 2013

Here is some documentation I found on the "scope" option:

http://www.idevelopment.info/data/LDAP/LDAP_Resources/SEARCH_Setting_the_SCOPE_Parameter.shtml

Looks like we actually could also set it to "one" -- which would show all items immediately one node beneath the search object ( with the search object being "ou=people,dc=ldap,dc=example,dc=com").

@hackartisan
Copy link
Contributor

We no longer need db.js, or the autheremin dependency.

We should add a file, ldap.js with a dependency on ldapjs.

note these dependencies are in server.js and routes/validate.js. do we need them in server.js?

@gsf
Copy link
Member Author

gsf commented Oct 21, 2013

In integrating LDAP into auther we'll also have to rethink the tests. Can we stub this out in some way or should we run a fake LDAP server?

@gsf
Copy link
Member Author

gsf commented Oct 21, 2013

We don't need the autheremin reference in server.js (I've removed it). We won't need that "db.on('load')" business either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants