spring-projects / spring-projects/spring-ldap

ContextSource pool problem when using DirSync

Open
#534 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

java 1.8
spring boot: 2.0.3.RELEASE
spring-ldap-core: 2.3.2.RELEASE

When I use DirSync cookie for control response in one request,
it seems that all other requests called using this ContextSource start using DirSync

test:

public void callQueryAfterDirsync() {
    DirSyncContextProcesor proc = new DirSyncContextProcesor(null);
    getByDirsync(proc);
    SearchControls controls = new SearchControls();
    controls.setTimeLimit(0);
    controls.setCountLimit(0);
    controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
    String [] attr =  {"memberOf"};
    controls.setReturningAttributes(attr);
    List<LdapUser> result = template.search("", "cn=myUser", controls,  userContextMapper);
    System.out.println(result.get(0).getDnAdGroups().toString());
}
    
public List<LdapUser> getByDirsync(DirContextProcessor proc) {
    SearchControls controls = new SearchControls();
    controls.setTimeLimit(0);
    controls.setCountLimit(0);
    controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
    return template.search("", "objectClass=user", controls, userContextMapper, proc);
}

If I call normal search after dirSync search I cannot get memberOf attribute any more

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 by running the provided Java reproduction with Spring LDAP 2.3.2 and compare a normal search before and after getByDirsync. Inspect the ContextSource pooling behavior and DirSyncContextProcesor interaction; done means a normal search after a DirSync search still returns the memberOf attribute.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.