org.ldaptive.ssl
Class TLSSocketFactory

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
Direct Known Subclasses:
DefaultHostnameVerifier.SSLSocketFactory, ThreadLocalTLSSocketFactory

public class TLSSocketFactory
extends AbstractTLSSocketFactory

An extension of SSLSocketFactory that leverages an SSL context initializer. Note that initialize() must be called prior to using this socket factory. This means that this class cannot be passed to implementations that expect the socket factory to function immediately after construction.

Version:
$Revision: 3120 $ $Date: 2015-10-01 11:50:02 -0400 (Thu, 01 Oct 2015) $
Author:
Middleware Services

Field Summary
 
Fields inherited from class org.ldaptive.ssl.AbstractTLSSocketFactory
DEFAULT_PROTOCOL, factory, logger
 
Constructor Summary
TLSSocketFactory()
           
 
Method Summary
protected static void addHostnameVerifyingTrustManager(SslConfig config, String[] names)
          Adds a HostnameVerifyingTrustManager to the supplied config if no trust managers have been configured.
static SocketFactory getDefault()
          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.
 void initialize()
          Creates the underlying SSLContext using truststore and keystore attributes and makes this factory ready for use.
 String toString()
          
 
Methods inherited from class org.ldaptive.ssl.AbstractTLSSocketFactory
createSocket, createSocket, createSocket, createSocket, createSocket, createSocket, getDefaultCipherSuites, getFactory, getHostnameVerifier, getSocketConfig, getSslConfig, getSupportedCipherSuites, initSSLSocket, setHostnameVerifier, setSocketConfig, setSslConfig
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TLSSocketFactory

public TLSSocketFactory()
Method Detail

initialize

public void initialize()
                throws GeneralSecurityException
Creates the underlying SSLContext using truststore and keystore attributes and makes this factory ready for use. Must be called before factory can be used.

Specified by:
initialize in class AbstractTLSSocketFactory
Throws:
GeneralSecurityException - if the SSLContext cannot be created

getDefault

public static SocketFactory getDefault()
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 addHostnameVerifyingTrustManager(SslConfig, String[]).

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

addHostnameVerifyingTrustManager

protected static void addHostnameVerifyingTrustManager(SslConfig config,
                                                       String[] names)
Adds a HostnameVerifyingTrustManager to the supplied config if no trust managers have been configured. A DefaultTrustManager is also added in no CredentialConfig has been configured.

Parameters:
config - to modify
names - of the hosts to verify

toString

public String toString()

Overrides:
toString in class Object


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