Claus Ibsen created CAMEL-27884:
-----------------------------------

             Summary: camel-spring-ldap: the dn of the body is ignored when the 
context source has a base DN, a missing LdapTemplate fails late, an unknown 
scope searches the subtree
                 Key: CAMEL-27884
                 URL: https://issues.apache.org/jira/browse/CAMEL-27884
             Project: Camel
          Issue Type: Bug
            Reporter: Claus Ibsen
             Fix For: 4.25.0


Found while improving the option descriptions of camel-spring-ldap for 
CAMEL-23832 (pull request https://github.com/apache/camel/pull/31155).
These are separate problems of the component; the descriptions change only 
documents the current behavior.

h4. 1. The dn of the body is ignored with a base DN
{{SpringLdapProducer.process}} sets dn to "" whenever the ContextSource is a 
BaseLdapPathContextSource with a non-empty base, so bind, unbind and 
modify_attributes act on the base entry itself (unbind tries to delete the 
base, bind to create it), and a dn relative to the base cannot be given. This 
came with CAMEL-19293 (commit 772a8c8898e2), which fixed the base being 
prepended twice.
Proposed change: use the dn of the body as a name relative to the base when 
present, and "" only when missing.

h4. 2. A missing LdapTemplate fails on the first message
{{SpringLdapComponent.createEndpoint}} creates the endpoint even when 
lookupByNameAndType(remaining, LdapTemplate.class) returns null; the first 
message then fails with a NullPointerException.
Proposed change: throw NoSuchBeanException when the endpoint is created.

h4. 3. An unknown scope searches the subtree
{{SpringLdapEndpoint.scopeValue}} is case-sensitive and falls back to SUBTREE 
without a warning, so scope=OBJECT or a typo searches the whole subtree.
Proposed change: parse case-insensitively and reject unknown values.

h4. 4. scope is not used by authenticate
authenticate builds the LdapQuery without searchScope, so the 
defaultSearchScope of the LdapTemplate applies.
Proposed change: pass .searchScope(...) as well.


_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to