Announcement Announcement Module
Collapse
No announcement yet.
strip base dn Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • strip base dn

    I have my base dn set in the LdapContextSource within the applicationContext configuration.

    Sometimes when I'm doing a lookup I have the full DN string of a user (inc. base dn). So when I create a DistinguishedName object with that DN string, and do a lookup.... it won't find it but if I strip out the base dn, it will.

    So... I suppose I have to strip out the base dn from my string.

    Without hardcoding the base dn in my code, I was thinking I could grab it from the contextSource..... but how do I get this?

    The ldaptemplate only has a setContextSource and no get.... so is there an easy way to grab that basedn value?

    OR is there even an easier way to approach this?


    thanks!

  • #2
    The preferred way of getting the full dn of an entry is to use DirContextAdapter.getNameInNamespace(). That automatically prepends the base DN to the dn of the entry.

    Comment

    Working...
    X