nickw444 / flask-ldap3-login

LDAP3 Logins for Flask/Flask-Login
http://flask-ldap3-login.readthedocs.org/en/latest/
MIT License
73 stars 38 forks source link

'ascii' codec can't encode character u'\xf6' in position 15: ordinal not in range(128) #58

Closed nnew2 closed 5 years ago

nnew2 commented 5 years ago

DEBUG:flask_ldap3_login:Opening connection with bind user 'domain.local\foobar' DEBUG:flask_ldap3_login:Successfully bound to LDAP as 'domain.local\foobar' for search_bind method DEBUG:flask_ldap3_login:Performing an LDAP Search using filter '(&(objectclass=person)(displayName=foobar))', base 'CN=Users,DC=xxxxxx,DC=sec', and scope 'LEVEL' 'ascii' codec can't encode character u'\xf6' in position 15: ordinal not in range(128)

When non-ascii characters is returned from a search

`

    config = dict()

    config['LDAP_HOST'] = "x.x.x.x"
    config['LDAP_BASE_DN'] = "DC=xxxxxx,DC=sec"
    config['LDAP_BIND_USER_DN'] = "domain.local\foobar"
    config['LDAP_BIND_USER_PASSWORD'] = "password"
    config['LDAP_USER_LOGIN_ATTR'] = "sAMAccountName"
    config['LDAP_USER_DN'] = "CN=Users"
    config['LDAP_GROUP_DN'] = "CN=Users"

    ldap_manager = LDAP3LoginManager()
    ldap_manager.init_config(config)

    response = ldap_manager.authenticate("foobar", "password)
    print(response.status)

`

I noticed this happened to my user which has an "ö" in the Full name field.

Regards

nickw444 commented 5 years ago

I noticed this happened to my user which has an "ö" in the Full name field.

Very weird. I had a quick look through the code and there doesn't seem to be any explicit points in the code where an ascii encode/decode operation is performed.

Can you try using the ldap3 library directly with the same user credentials? It could be an issue in ldap3 rather than this library.

nickw444 commented 5 years ago

Closing this issue due to inactivity.

Also, just a side note: after a long internal debate, I have made the difficult decision that I will no longer be actively maintaining this repo. I am now in the process of finding a new maintainer - if this is something that may interest you, you can find more details in the README