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

authentication and verify user part of ldap group #65

Open
sukumarkonduru opened this issue Aug 15, 2019 · 2 comments
Open

authentication and verify user part of ldap group #65

sukumarkonduru opened this issue Aug 15, 2019 · 2 comments
Labels

Comments

@sukumarkonduru
Copy link

sukumarkonduru commented Aug 15, 2019

I am using APIs to verify credentials and also make sure user is part of either of two ldap groups to access the application. I enabled debugging and able to verify that user is authenticated successfully. However, when it is searching for the groups, I see the following and retrieves hundreds of users (maybe all users)

------------------
Searching for groups for specific user with filter '(&(objectclass=group)(member=CN=CHINNI,OU=Information_Services,OU=KMC,DC=Kids,DC=med))' , base 'cn=users,DC=Kids,DC=med' and scope 'LEVEL'
DEBUG:flask_ldap3_login:Searching for groups for specific user with filter '(&(objectclass=group)(member=CN=CHINNI,OU=Information_Services,OU=KMC,DC=Kids,DC=med))' , base 'cn=users,DC=Kids,DC=med' and scope 'LEVEL'
-----------------------------------------

When I print in save_user(dn, username, data, memberships), the memberships contains hundreds of users which I can't even see all of them as it is getting cutoff. I thought I will see groups (10 or so) that are user is part of. When I do same following filter in AD, I see only group names

(member=CN=CHINNI,OU=Information_Services,OU=KMC,DC=Kids,DC=med))' , base 'cn=users,DC=Kids,DC=med' and scope 'LEVEL'
-----------------

Appreciate help to understand what is this memberships means and how do I get only group names that user belongs so that I can iterate to make sure he is part of proper group. System freezes as it is getting all users.

Edited by @gmacon 2020-02-24: Literal formatting for log outputs.

@auto-comment

This comment has been minimized.

@gmacon
Copy link
Collaborator

gmacon commented Feb 25, 2020

I suspect you're seeing only the groups that the currently authenticating user is a member of, but, because the group membership is stored on the group object, you're also seeing every other user who is a member of those groups. You should be able to extract the information you care about and ignore everything else.

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

No branches or pull requests

2 participants