[JNDI/LDAP] Intercepting LDAP URLs with initial and referral directory contexts
michael.osipov at siemens.com
Tue Apr 19 10:53:33 UTC 2016
I am looking for a clean way to intercept/alter LDAP URLs for both cases: initial and referrals (follow)
before the directory context is created actually.
In detail, I need to perform some AD related SRV lookups and replace the provided hostname which is actually
a naming context with a real hostname.
What I have achieved so far but am not really happy with:
I have registered an ldapURLContextFactory with Context.URL_PKG_PREFIXES where I can swap the URL but
this a really ugly solution because initial connections are not routed through this factory, only referral
ones. Additionally, I have to create a complete Context which my class is not willing to do, but merely
extends the private class com.sun.jndi.url.ldap.ldapURLContextFactory.
My questions are:
1. How can I intercept initial contexts creations too with the same ObjectFactory?
2. How do I get rid of the dependency to that private Sun class?
Thanks and regards,
More information about the core-libs-dev