JackAdams / meteor-accounts-ldap

Authentication against an LDAP server in Meteor
MIT License
21 stars 12 forks source link

Custom filter #1

Closed Suppen closed 9 years ago

Suppen commented 9 years ago

Hello

I am using this package in one of my projects at work, but I had to do one small modification to make it work: The search filter does not match our structure. I don't know much about LDAP, so it could be our structure which is silly. Anyway, it refused to log me in until I changed line 50 in ldap_server.js from

filter: '(&(' + ((email) ? 'mail' : 'cn') + '=' + searchUsername + ')(objectClass=user))', to filter: '(&(' + ((email) ? 'mail' : 'sAMAccountName') + '=' + searchUsername + ')(objectClass=user))',

It then works when I try to log in with my username, but not my email. I haven't bothered checking why, because the application is supposed to use only the username

It would be nice to have the filter as a setting to account for strange LDAP setups.

JackAdams commented 9 years ago

Okay. Fair request. New release (0.1.1) adds ability to specify a custom filter programmatically. How to do it is near the bottom of the README.md.

Suppen commented 9 years ago

That was damn quick. Will test!

JackAdams commented 9 years ago

Would have been quicker, but my little four year old girl wanted a cup of tea and some potato chips, which cost me five minutes. :-p

Suppen commented 9 years ago

Weird problem:

$ meteor add babrahams:accounts-ldap
 => Errors while adding packages:             

While checking for babrahams:accounts-ldap@0.1.1:
error: No compatible binary build found for this package. Contact the package author and ask them to publish it for your platform.

This happens in all my projects, even one I created just to test. I checked your changes, and see no reason for it. It works if I clone this repo and add it as a local package... Any idea?

The custom filter function works nicely

JackAdams commented 9 years ago

Oh shoot. My bad. Publishing the builds now. Give me five mins.

JackAdams commented 9 years ago

All right. Should be good to go now. Thanks for letting me know about the missing binaries.

Suppen commented 9 years ago

Great! Works like a charm now. Thanks!