spring-projects / spring-projects/spring-ldap
Provide a way to search in multiple base DNs
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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