通过Active Directory 2008进行Django LDAP认证

问题描述

| 我正在尝试通过企业Active Directory服务器对用户进行身份验证。 我无法正确配置它,我知道LDAP可以正常工作,但是我有一个MediaWiki已配置并且可以正常工作 在Active Directory服务器上进行身份验证。 系统:
    Active Directory 2008
    Django (1,3,\'final\',0)
    django-auth-ldap 1.0.9
这是我在settings.py中的配置
    from django_auth_ldap.config import LDAPSearch
    import logging

    # makes sure this works in Active Directory
    ldap.set_option(ldap.OPT_REFERRALS,0)

    LDAP_SERVER_URI = \'ldap://ad.exemple.com\'
    AUTH_LDAP_BIND_DN = \'my_user\'
    AUTH_LDAP_BIND_PASSWORD = \'my_pass\'
    AUTH_LDAP_USER_SEARCH = LDAPSearch(\'dc=exemple,dc=com\',ldap.SCOPE_SUBTREE,\'(SAMAccountName=%(user)s)\')

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

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

    AUTHENTICATION_BACKENDS = (
            \'django_auth_ldap.backend.LDAPBackend\',\'django.contrib.auth.backends.ModelBackend\',)
我还通过添加新的URI尝试了ssl方式
    LDAP_SERVER_URI = \'ldaps://ad.exemple.com:636\'
我使用了主要组User来搜索,我不需要要验证的任何特定组。 错误消息返回错误:
    WARNING 2011-05-31 16:50:19,429 backend 3968 140632428340992 Caught LDAPError while authenticating my_user: INVALID_CREDENTIALS({\'info\': \'80090308: LdapErr: DSID-0C0903AA,comment: AcceptSecurityContext error,data 525,v1772\',\'desc\': \'Invalid credentials\'},)
    [31/May/2011 16:50:19] \"POST /admin/ HTTP/1.1\" 200 9648
看到此错误并寻找LDAP错误DSID-0C0903AA我发现我应该尝试设置这样的用户名
[email protected]
它不起作用,它返回错误:
    ERROR 2011-05-31 16:55:38,947 config 6505 139868662060800 search_s(\'dc=ubilium,dc=loc\',2,\'(SAMAccountName=my_user)\') raised OPERATIONS_ERROR({\'info\': \'000004DC: LdapErr: DSID-0C0906DD,comment: In order to perform this operation a successful bind must be completed on the connection.,data 0,\'desc\': \'Operations error\'},)
    DEBUG 2011-05-31 16:55:38,947 backend 6505 139868662060800 Authentication failed for my_user
有谁知道如何使其连接?     

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)