7

Any chance that LDAP authentication will be integrated into Meteor.js in the near future?

Any hints on how to get this to work today?

zealoushacker
  • 6,766
  • 5
  • 35
  • 44
cosmikwolf
  • 399
  • 7
  • 15

3 Answers3

4

Whenever working with meteor, I would suggest looking at resources that are available for node.js, when and if something isn't in the meteor docs, and there isn't already a relevant discussion here.

The reason this seems like a good start would be that meteor runs inside a node.js server instance inside a fiber. At the very least existing node.js modules may help you understand where to go next.

By performing a cursory google search for nodejs ldap, I had discovered a couple of very useful resources:

http://blog.nodejs.org/2011/09/08/ldapjs-a-reprise-of-ldap/ http://ldapjs.org/

Finally, you will likely need the answer to this question to get you on your way: it possible use a nodejs package inside meteor app?

Community
  • 1
  • 1
zealoushacker
  • 6,766
  • 5
  • 35
  • 44
1

As of 2015 the best available package is https://atmospherejs.com/typ/accounts-ldap

meteor add typ:accounts-ldap

I used this package in a few projects and from my experience it always requires the dn to authenticate. If you want to use the email instead, you would first have to find the dn with a separate query (ideally your LDAP offers you some sort of resolver / API to query the dn by email).

On the server side, you configure the following default (any file exposed to the server):

LDAP_DEFAULTS.url = 'ldap://my-ldap-host.com'

On the client side, you can then call:

Meteor.loginWithLDAP(login, password, { dn: 'the-resolved-dn' }, function(err) {
  if (err) {
    // login failed
  }
  else {
    // login successful
  }
}
Peter Ilfrich
  • 3,727
  • 3
  • 31
  • 35
0

Your best bet at the moment is to look through the code in https://github.com/emgee3/meteor-accounts-ldap and try to adapt it for your own purposes.

jackadams49
  • 146
  • 1
  • 5