Replies: 3 comments
-
|
我当时好像也没配成功,后面跟着django的文档走的 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Beta Was this translation helpful? Give feedback.
0 replies
-
ENABLE_LDAP = True
if ENABLE_LDAP:
import ldap
from django_auth_ldap.config import LDAPSearch
AUTHENTICATION_BACKENDS = (
'django_auth_ldap.backend.LDAPBackend', # 配置为先使用LDAP认证,如通过认证则不再使用后面的认证方式
'django.contrib.auth.backends.ModelBackend', # django系统中手动创建的用户也可使用,优先级靠后。注意这2行的顺序
)
AUTH_LDAP_SERVER_URI = "ldap://ldap.my_domain.com:389"
AUTH_LDAP_BIND_DN = "cn=admin,dc=my_domain,dc=com"
AUTH_LDAP_BIND_PASSWORD = "my_ladp_passwd"
#AUTH_LDAP_USER_DN_TEMPLATE = "uid=%(user)s,ou=研发中心,ou=my_ou,dc=my_domain,dc=com" #不要使用 存在问题
AUTH_LDAP_USER_SEARCH = LDAPSearch(
"ou=研发中心,ou=my_ou,dc=my_domain,dc=com",
ldap.SCOPE_SUBTREE,
"(uid=%(user)s)",
)
AUTH_LDAP_ALWAYS_UPDATE_USER = True # 每次登录从ldap同步用户信息
AUTH_LDAP_USER_ATTR_MAP = { # key为archery.sql_users字段名,value为ldap中字段名,用户同步信息
"username": "uid",
"display": "sn",
"email": "mail"
}使用这个配置是可以的,即不要使用AUTH_LDAP_USER_DN_TEMPLATE,改为使用AUTH_LDAP_USER_SEARCH |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


Uh oh!
There was an error while loading. Please reload this page.
-
问题描述
ldap根据文档进行配置,配置完后不生效
版本信息
Beta Was this translation helpful? Give feedback.
All reactions