Skip to content

"LDAP user attributes empty" AFTER "LDAP connect succeeded" #252

@SeanFromOhio

Description

@SeanFromOhio

I am having problems with getting my Django authentication system working with Active Directory.
I am able to sign in and it says LDAP connect succeeded, but then it fails and prints that 'LDAP user attributes empty.'

I was able to connect and see attributes when doing it in a Python Console using ldap3.
I've tried changing the OBJECT_CLASS to be 'person', 'user', 'inetOrgPerson', 'top' but all yield the same result.

Any ideas would be appreciated!

Settings (***** indicates sensitive info):
`AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
'django_python3_ldap.auth.LDAPBackend',
)

LDAP_AUTH_URL = 'ldap://:389'
LDAP_AUTH_CONNECTION_USERNAME = '
'
LDAP_AUTH_CONNECTION_PASSWORD = '*****' # TODO: Secure this!!!
LDAP_AUTH_FORMAT_USERNAME = 'django_python3_ldap.utils.format_username_active_directory'
LDAP_AUTH_USER_FIELDS = {
"username": "sAMAccountName",
"first_name": "givenName",
"last_name": "sn",
"email": "mail"
}
LDAP_AUTH_SEARCH_BASE = 'dc=priv,dc=*****g,dc=co'
LDAP_AUTH_OBJECT_CLASS = "user"
LDAP_AUTH_USER_LOOKUP_FIELDS = ("username",)
LDAP_AUTH_FORMAT_SEARCH_FILTERS = "django_python3_ldap.utils.format_search_filters"
LDAP_AUTH_SYNC_USER_RELATIONS = "django_python3_ldap.utils.sync_user_relations"
LDAP_AUTH_CLEAN_USER_DATA = "django_python3_ldap.utils.clean_user_data"

LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"handlers": {
"console": {
"class": "logging.StreamHandler",
},
},
"loggers": {
"django_python3_ldap": {
"handlers": ["console"],
"level": "INFO",
},
},
}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions