我有一个容器化应用程序,它使用django-auth-ldap为用户搜索Active。我想把两个独立的OU的输出结合起来。是否有不同的方法或重载可以使用两个DN,或者连接两个单独搜索的输出?
AUTH_LDAP_USER_SEARCH = LDAPSearch(os.environ.get('AUTH_LDAP_USER_SEARCH_BASEDN', ''),
ldap.SCOPE_SUBTREE,
"(sAMAccountName=%(user)s)")发布于 2018-08-23 20:02:34
摘自更新的文件
新版本1.1。 如果需要在多个位置搜索用户,可以使用LDAPSearchUnion。这将获取多个
LDAPSearch对象,并返回结果的联合。未指定基础搜索的优先级。
import ldap
from django_auth_ldap.config import LDAPSearch, LDAPSearchUnion
AUTH_LDAP_USER_SEARCH = LDAPSearchUnion(
LDAPSearch("ou=users,dc=example,dc=com", ldap.SCOPE_SUBTREE, "(uid=%(user)s)"),
LDAPSearch("ou=otherusers,dc=example,dc=com", ldap.SCOPE_SUBTREE, "(uid=%(user)s)"),
)https://stackoverflow.com/questions/51953916
复制相似问题