我試圖建立對我們的LDAP用戶認證:django_auth_ldap提高OPERATIONS_ERROR
settings.py:
AUTHENTICATION_BACKENDS = (
'django_auth_ldap.backend.LDAPBackend',
'django.contrib.auth.backends.ModelBackend',
)
AUTH_LDAP_SERVER_URI = "ldap://********-dc01.*******.ru"
import ldap
from django_auth_ldap.config import LDAPSearch
AUTH_LDAP_BIND_DN = ""
AUTH_LDAP_BIND_PASSWORD = ""
AUTH_LDAP_USER_SEARCH = LDAPSearch("cn=users,dc=*********,dc=ru",ldap.SCOPE_SUBTREE,"(uid=%(user)s)")
AUTH_LDAP_USER_ATTR_MAP = {
"first_name": "givenName",
"last_name": "sn",
"email": "mail"
}
import logging
logger = logging.getLogger('django_auth_ldap')
logger.addHandler(logging.StreamHandler())
logger.setLevel(logging.DEBUG)
views.py:
@login_required
def project_list(request):
...
urls.py:
(r'^accounts/login/$', 'django.contrib.auth.views.login',{'template_name':'login.html'}),
和t模板是from this example。
它會帶我去權威性的形式和我碰到下面的調試輸出:
search_s('cn=users,dc=********,dc=ru', 2, '(uid=bolotnov)') raised OPERATIONS_ERROR({'info': '000004DC: LdapErr: DSID-0C0906DC, comment: In order to perform this operation a successful bind must be completed on the connection., data 0, v1db0', 'desc': 'Operations error'},)
search_s('cn=users,dc=**********,dc=ru', 2, '(uid=bolotnov)') raised OPERATIONS_ERROR({'info': '000004DC: LdapErr: DSID-0C0906DC, comment: In order to perform this operation a successful bind must be completed on the connection., data 0, v1db0', 'desc': 'Operations error'},)
Authentication failed for bolotnov
Authentication failed for bolotnov
我試着用搜索引擎,但沒有發現任何東西,可以幫助我進一步蛾,也許是從社區的暗示 - 也許有是簡單的我想念或做一個檢查?我似乎能夠通過Softerra LDAP瀏覽器匿名綁定到我們的LDAP,也許ldap_auth_user_search應該有點不同?
我想我知道這個問題是什麼,但無法驗證它。它將嘗試使用用戶在登錄名/密碼字段中提供的相同憑據來綁定到LDAP服務器以獲取用戶的首選項。會發生什麼 - 用戶愉快地發現/驗證了登錄/密碼令牌BUT綁定到LDAP,服務器期望也提供域名 - 這是造成問題的原因。 – abolotnov 2012-02-13 18:52:45