Class LdapSslSocketFactory

java.lang.Object
javax.net.SocketFactory
javax.net.ssl.SSLSocketFactory
org.springframework.boot.ldap.autoconfigure.LdapSslSocketFactory

public final class LdapSslSocketFactory extends SSLSocketFactory
Bridges the JNDI java.naming.ldap.factory.socket environment property to an SslBundle. That property only accepts a class name, which JNDI loads and on which it then calls getDefault(), with no way of passing an actual factory instance. The bundle to use is therefore held in a static field.

JNDI calls getDefault() once per new connection and the SslBundle is asked for a fresh SSLContext each time, so key and trust material of a bundle that has been reloaded is picked up by connections opened from then on. Reloading is only tracked for a bundle configured by name through spring.ldap.ssl.bundle; a bundle supplied by a custom LdapConnectionDetails is used as given.

As the bundle is held statically, a single SslBundle applies JVM-wide. This is sufficient for the auto-configured LdapContextSource, of which there is at most one per application context.

This class is referenced by name from a JNDI environment and is not intended to be used directly.

Since:
4.2.0
Author:
Moritz Halbritter