Banno / getsentry-ldap-auth

A Sentry extension to add an LDAP server as an authention source.
Apache License 2.0
163 stars 54 forks source link

constraint violation after logout #8

Closed bibby closed 8 years ago

bibby commented 8 years ago

Originally filed as a sentry issue, I wanted to ask if this is known or reproducible for you guys; before I look into it further.

bibby commented 8 years ago

I figured it out.

The ldap attribute that I was searching on for AUTH_LDAP_USER_SEARCH did not match the username field in the AUTH_LDAP_USER_ATTR_MAP.

AUTH_LDAP_USER_SEARCH = LDAPSearch(
    'ou=people,dc=vpn,dc=company,dc=com',
    ldap.SCOPE_SUBTREE,
    '(uid=%(user)s)',
)

AUTH_LDAP_USER_ATTR_MAP = {
    'username': 'uid',
    'email': 'mail'
}

As in this example, the uid component of both items were needed. Using cn or another field for username in the attr_map will cause bad times.

adsanz commented 5 years ago

This actually saved me tons of hours of research. Thanks a lot for noticing this, my problem is that the data on the localDB wasn't the same as the LDAP because some changes were made, wen trying to authenticate checking on the local DB the user did not match the same fields therefore try to create a new user which failed because the username is unique.