简体   繁体   English

将用户与两个组的 ldap 联系起来

[英]Getting to connect users with an ldap with two groups

I have an application with which I would like to connect my ldap users.我有一个应用程序,我想用它来连接我的 ldap 用户。 I want two types of users to be able to log in: internal and external.我希望两种类型的用户能够登录:内部和外部。

In the application that I deploy, three parameters are taken into account (ldapjs protocol, scope sub)在我部署的应用程序中,考虑了三个参数(ldapjs 协议,scope 子)

export LDAP_FILTER LDAP_BASEDN LDAP_UIDTAG

How do I get "OU=Internal,OU=Users,DC=test,DC=example,DC=com" and "OU=External,OU=Users,DC=test,DC=example,DC=com" members to connect to it?如何获取"OU=Internal,OU=Users,DC=test,DC=example,DC=com""OU=External,OU=Users,DC=test,DC=example,DC=com"成员进行连接到吗?

How should I fill in these parameters knowing that the cn is username?知道cn是用户名,这些参数应该怎么填呢?

Thank you for your help谢谢您的帮助

I tried我试过了

export LDAP_FILTER (|(&(ou=Internal)(cn={{username}}))(&(ou=External)(cn={{username}}))

and many more还有很多

Those are OU's (organizational units) not groups.这些是 OU(组织单位)而不是组。 You cannot filter by OU in an LDAP filter.您不能在 LDAP 过滤器中按 OU 进行过滤。 You use the Base DN to limit results to one OU.您使用基本 DN 将结果限制为一个 OU。 However, you can only use one.但是,您只能使用一个。

You may be better off creating a group and adding all of the users from both OUs into that group, and then you can filter on the group, like this:您最好创建一个组并将两个 OU 中的所有用户添加到该组中,然后您可以对该组进行过滤,如下所示:

(memberOf=CN=MyAppGroup,OU=Groups,DC=test,DC=example,DC=com)

That should be the full distinguishedName of the group.那应该是该组的完整distinguishedName

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM