【发布时间】:2011-09-15 10:46:43
【问题描述】:
我正在使用 Django 1.3 和 Django Auth Ldap 1.0.6。我正在尝试让在 LDAP 服务器上具有特殊状态的用户(管理员)在我的 Django 应用程序中具有相同的状态。
这些是我当前的设置:
AUTH_LDAP_SERVER_URI = 'ldap://path.to.server'
AUTH_LDAP_BIND_DN = ''
AUTH_LDAP_BIND_PASSWORD = ''
AUTH_LDAP_USER_DN_TEMPLATE = 'uid=%(user)s,cn=users,dc=server,dc=location,dc=lan'
AUTH_LDAP_GROUP_SEARCH = LDAPSearch(
'cn=groups,dc=server,dc=location,dc=lan',
ldap.SCOPE_SUBTREE,
'(objectClass=groupOfNames)',
)
AUTH_LDAP_USER_ATTR_MAP = {
'first_name': 'givenName',
'last_name': 'sn',
}
AUTH_LDAP_USER_FLAGS_BY_GROUP = {
#'is_active': 'cn=groups,dc=server,dc=location,dc=lan',
#'is_staff': 'cn=admin,cn=groups,dc=server,dc=location,dc=lan',
#'is_superuser': 'cn=admin,cn=groups,dc=server,dc=location,dc=lan',
}
AUTH_LDAP_ALWAYS_UPDATE_USER = True
AUTH_LDAP_MIRROR_GROUPS = True
AUTH_LDAP_FIND_GROUPS_PERMS = True
权限未更新。如果我取消注释 FLAGS_BY_GROUP 中的值,我将无法再进行身份验证(错误消息显示用户和密码不匹配)。我尝试不使用最后一个设置,结果相同。
高度赞赏任何想法。
【问题讨论】:
标签: python django ldap authentication