Skip to content

Separate LDAP lookup fields from User lookup fields #273

@jholladay10

Description

@jholladay10

It seems that the LDAP lookup names are the same as the User lookup names (both taken from LDAP_AUTH_USER_LOOKUP_FIELDS. I'd like them to be allowed to be separate.

My scenario occurs with Active Directory. I don't know whether it can occur with OpenLDAP.

As an example, I would like to use sAMAccount name to authenticate as AD, but use the object GUID to look up the user. That way, if a user's sAMAccountName changes, their permissions will remain associated with their object guid instead of losing their permissions or, worse, assuming someone else's permissions who previously had that sAMAccount name. I think the same could apply to upn. This does introduce the edge case of an "old" username conflicting with a "new" username in the database.

To address this, i would:

  1. Create a setting LDAP_AUTH_USER_BIND_FIELDS
  2. Use this value or, if empty, use LDAP_AUTH_USER_LOOKUP_FIELDS, when binding to LDAP
  3. When getting the user, if the user lookup fields are different than the bind fields, look up the user on each set and compare them.
  4. If the user object is the same or the username lookup failed to retrieve an object, then there is no conflict and the current behavior is fine.
  5. If there is a conflict, then the current object guid can retain the current LDAP lookup fields, and the LDAP lookup fields for the other user object need to be updated to eliminate the conflict. A default AD implementation would be to look up the conflicting user on their object guid and update their user record to reflect the current sAMAccountName for that object.

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