【问题标题】:django-ldap auth and django 1.6 deprecated warning on user_profiledjango-ldap auth 和 django 1.6 已弃用 user_profile 上的警告
【发布时间】:2014-07-22 09:13:45
【问题描述】:

在运行 python 2.7 的 linux 上使用 django-auth-ldap (1.2.0) 和 django 1.6 时,我收到警告:

The use of AUTH_PROFILE_MODULE to define user profiles has been deprecated.
  profile = self._user.get_profile()

我的 settings.py 包含 LDAP 设置:

import ldap
from django_auth_ldap.config import LDAPSearch, GroupOfNamesType

# Keep ModelBackend around for per-user permissions and maybe a local
# superuser.
AUTHENTICATION_BACKENDS = (
    'django_auth_ldap.backend.LDAPBackend',
    'django.contrib.auth.backends.ModelBackend',
)

AUTH_LDAP_SERVER_URI = "ldap://127.0.0.1"
AUTH_LDAP_BIND_DN = "cn=ram Krishna,ou=users,dc=test,dc=com"
AUTH_LDAP_BIND_PASSWORD = "ram"
AUTH_LDAP_USER_SEARCH = LDAPSearch("ou=users,dc=test,dc=com",
                                   ldap.SCOPE_SUBTREE, "(uid=%(user)s)")

此 py 文件中没有 LDAP 的其他设置

我使用 ldapsearch -x 的 slapd 条目显示:

# ram Krishna, users, test.com
dn: cn=ram Krishna,ou=users,dc=test,dc=com
cn: ram Krishna
mail: ram@y.com
givenName: ram
sn: Krishna
objectClass: inetOrgPerson
objectClass: top
uid: ram

为什么我无法进行身份验证?

【问题讨论】:

标签: python django openldap django-auth-ldap


【解决方案1】:

我收到同样的警告,但我的 ldap 工作正常。

我只看到你的 LDAP 设置和我的 2 点不同

1. AUTH_LDAP_BIND_DN = "???@test.com"
2. AUTH_LDAP_USER_SEARCH = LDAPSearch("ou=users,dc=test,dc=com", ldap.SCOPE_SUBTREE, u"(sAMAccountName=%(user)s)")

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-16
    相关资源
    最近更新 更多