【问题标题】:django-auth-ldap with Active Directory not pulling "Domain Users" groupdjango-auth-ldap 与 Active Directory 不拉“域用户”组
【发布时间】:2016-06-30 12:46:54
【问题描述】:

我的settings.py 中有以下内容,它工作正常并针对 Active Directory 进行身份验证。除了我需要在当前项目中使用的“域用户”组之外,此配置将所有组都拉入 Django Admin 应用程序。有谁知道为什么这是唯一没有出现在管理应用程序中的组??

settings.py

# LDAP Settings

# Baseline configuration
AUTH_LDAP_SERVER_URI = "ldaps://DC1@example.com:636"
AUTH_LDAP_BIND_DN = "user@example.com"
AUTH_LDAP_BIND_PASSWORD = "password"
AUTH_LDAP_USER_SEARCH = LDAPSearch("DC=example,DC=com", ldap.SCOPE_SUBTREE, "(&(objectClass=user)(samAccountName=%(user)s))")
AUTH_LDAP_CONNECTION_OPTIONS = {
    ldap.OPT_DEBUG_LEVEL: 0,
    ldap.OPT_REFERRALS: 0,
}

# Populate Django user from LDAP directory
AUTH_LDAP_USER_ATTR_MAP = {
    "first_name": "givenName",
    "last_name": "sn",
    "email": "mail"
}

# Set up the basic group parameters.
AUTH_LDAP_GROUP_SEARCH = LDAPSearch("dc=example,dc=com",
                                    ldap.SCOPE_SUBTREE, "(objectClass=group)")

AUTH_LDAP_GROUP_TYPE = ActiveDirectoryGroupType(name_attr='cn')

# Pull AD groups into Django
AUTH_LDAP_MIRROR_GROUPS = True

# This is the default, but I like to be explicit.
AUTH_LDAP_ALWAYS_UPDATE_USER = True

# Configure both backend systems
AUTHENTICATION_BACKENDS = {
    'django_auth_ldap.backend.LDAPBackend',
    'django.contrib.auth.backends.ModelBackend',
}

【问题讨论】:

  • 你有没有想过这个问题?

标签: python django django-auth-ldap


【解决方案1】:

“域用户”组位于用户容器内

"cn=Users,dc=example,dc=com"

查看此链接的解决方案。

https://github.com/ednaldodias/django-adldap-sync-primarygroup

【讨论】:

    猜你喜欢
    • 2019-04-11
    • 2011-02-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多