spring-projects / spring-projects/spring-ldap

Provide a way to search in multiple base DNs

Open
#636 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in: core type: enhancement
Dominant language
Java
Stars
375
Forks
501
Avg merge
6h 4m
Merged PRs (30d)
63

Description

In my ldap the users are located in DN=(ou=users,dc=example,dc=com), and service accounts in DN=(ou=sa,dc=example,dc=com). The size of LDAP is huge and it is crucial to limit the search scope to these org. units.
But I have the same entity to be retrieved from these ous:

@Entry(objectClasses = ["top", "person", "user"])
class LdapUser {
    @Id
    lateinit var id: Name

    @Attribute(name = "objectGUID", type = Attribute.Type.BINARY)
    lateinit var objectGUID: ByteArray
}

Therefore I have to perform the following code to search for the only record by objectGUID:

val ldapUser = ldapTemplate.find(
    query().base("ou=users").filter(guidFilter),
    LdapUser::class.java
).firstOrNull() ?: ldapTemplate.find(
    query().base("ou=sa").filter(guidFilter),
    LdapUser::class.java
).firstOrNull()

Please, provide a way to search multiple organizational units in one query.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the ldapTemplate.find and query().base calls shown in the issue, then trace how search bases are represented and passed into one LDAP query. Done means the same LdapUser lookup can search both ou=users and ou=sa without issuing the two separate searches shown.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kotlin
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.