-
Notifications
You must be signed in to change notification settings - Fork 100
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
LDAP user group/role checking #10
Comments
Hi, This does not really seem like authentication related thing. From what I got from the explanation this would seem more like something you would implement in the |
I've stumbled upon a similar need where |
In fact this will be a good idea :) |
I added a 'group lookup' to ldap-auth-fork. Code is here: https://github.com/jjg77/node-ldapauth-fork/blob/ismemberof/lib/ldapauth.js. The class takes 3 new opts: searchBaseGroups (required), searchFilterGroups (required), searchGroupAttributes (optional, but defaults to 'ismemberof') Which can be configured in the passport LdapStrategy like this:
The 'groups' get added to the user object and look like this:
|
OK, this is now resolved with the update of
eg. var opts = {
"server": {
"url": "ldaps://ldap.example.com:636",
"adminDn": "cn=LdapAdmin,dc=local",
"adminPassword": "LdapAdminPassword",
"searchBase": "dc=users,dc=local",
"searchFilter": "(&(objectClass=person)(sAMAccountName={{username}}))",
"searchAttributes": [
"dn", "cn", "givenName", "name", "memberOf", "sAMAccountName"
],
"groupSearchBase": "dc=groups,dc=local",
"groupSearchFilter": "(member={{dn}})",
"groupSearchAttributes": ["dn", "cn", "sAMAccountName"]
}
}; |
IMO this last answer is important enough to become part of the documentation. Also example with interpolation on property different than "dn" would be helpful. |
Please can you give an update to the documentation, i'm kinda new to LDAP |
Looking at the implementation, would it not make more sense to let the user create a dynamic group search query?
to be something like:
This way, one could also, for instance, retrieve the CN for a primary group (currently my customer has a set-up like this, in which the CN for the group cannot be retrieved by memberof): "groupSearchFilter": "(|(memberUid={{uid}})(gidNumber={{gidNumber}}))", |
@UXabre I don't really like the idea of looping over all properties of users when probably most of the replace calls would do nothing. I would however accept a pull request that does not break current functionality, but would enable giving a |
I agree, would be pointless to loop everything but the general idea is indeed what you propose. I'll see to make a pull request sometime this week :-) |
Meanwhile I have created the pull request for this extension and can be found here: vesse/node-ldapauth-fork#36 |
It would be great if there was a way to pass additional options for a group DN, group filter in such a way that when you authenticate a user then lookup what groups that user is a member of.
Example:
A search is done to find the user that exists and then perform another search to determine what groups the User is a member of by using the UserDN into the role/group search.
Thoughts?
The text was updated successfully, but these errors were encountered: