[JNDI/LDAP] Intercepting LDAP URLs with initial and referral directory contexts

Pavel Rappo pavel.rappo at oracle.com
Tue Apr 19 13:10:00 UTC 2016


Any chance these relates to what you are looking for?

"Automatic Discovery of LDAP Servers" [1] and "Manually Following Referrals" [2]?

--------------------------------------------------------------------------------
[1] http://docs.oracle.com/javase/jndi/tutorial/ldap/connect/create.html
[2] http://docs.oracle.com/javase/jndi/tutorial/ldap/referral/throw.html

> On 19 Apr 2016, at 11:53, Osipov, Michael <michael.osipov at siemens.com> wrote:
> 
> Hi folks,
> 
> 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,
> 
> Michael Osipov
> 
> 




More information about the core-libs-dev mailing list