org.ldaptive.ssl
Class ThreadLocalTLSSocketFactory

java.lang.Object
  extended by javax.net.SocketFactory
      extended by javax.net.ssl.SSLSocketFactory
          extended by org.ldaptive.ssl.AbstractTLSSocketFactory
              extended by org.ldaptive.ssl.TLSSocketFactory
                  extended by org.ldaptive.ssl.ThreadLocalTLSSocketFactory

public class ThreadLocalTLSSocketFactory
extends TLSSocketFactory

TLSSocketFactory implementation that uses a thread local variable to store configuration. Useful for SSL configurations that can only retrieve the SSLSocketFactory from getDefault().

Version:
$Revision: 3265 $ $Date: 2018-08-30 12:12:44 -0400 (Thu, 30 Aug 2018) $
Author:
Middleware Services

Field Summary
 
Fields inherited from class org.ldaptive.ssl.AbstractTLSSocketFactory
DEFAULT_PROTOCOL, factory, logger
 
Constructor Summary
ThreadLocalTLSSocketFactory()
           
 
Method Summary
static SocketFactory getDefault()
          This returns the default SSL socket factory.
static SSLSocketFactory getHostnameVerifierFactory(SslConfig config, String[] names)
          Returns an instance of this socket factory configured with a hostname verifying trust manager.
 SslConfig getSslConfig()
          Returns the SSL configuration used by this socket factory.
 void removeSslConfig()
          Removes the ssl config from the current thread-local value.
 void setSslConfig(SslConfig config)
          Sets the SSL configuration used by this socket factory.
 String toString()
          
 
Methods inherited from class org.ldaptive.ssl.TLSSocketFactory
addHostnameVerifyingTrustManager, createSSLContextInitializer, initialize
 
Methods inherited from class org.ldaptive.ssl.AbstractTLSSocketFactory
createSocket, createSocket, createSocket, createSocket, createSocket, createSocket, getDefaultCipherSuites, getFactory, getHostnameVerifier, getSocketConfig, getSupportedCipherSuites, initSSLSocket, setHostnameVerifier, setSocketConfig
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ThreadLocalTLSSocketFactory

public ThreadLocalTLSSocketFactory()
Method Detail

getSslConfig

public SslConfig getSslConfig()
Returns the SSL configuration used by this socket factory.

Overrides:
getSslConfig in class AbstractTLSSocketFactory
Returns:
ssl config

setSslConfig

public void setSslConfig(SslConfig config)
Sets the SSL configuration used by this socket factory.

Overrides:
setSslConfig in class AbstractTLSSocketFactory
Parameters:
config - ssl config

removeSslConfig

public void removeSslConfig()
Removes the ssl config from the current thread-local value.


getDefault

public static SocketFactory getDefault()
This returns the default SSL socket factory.

Returns:
socket factory

getHostnameVerifierFactory

public static SSLSocketFactory getHostnameVerifierFactory(SslConfig config,
                                                          String[] names)
Returns an instance of this socket factory configured with a hostname verifying trust manager. If the supplied ssl config does not contain trust managers, HostnameVerifyingTrustManager with DefaultHostnameVerifier is set. See TLSSocketFactory.addHostnameVerifyingTrustManager(SslConfig, String[]).

Parameters:
config - to set on the socket factory
names - to use for hostname verification
Returns:
socket factory

toString

public String toString()

Overrides:
toString in class TLSSocketFactory


Copyright © 2003-2017 Virginia Tech. All Rights Reserved.