org.ldaptive.ssl
Class AbstractSSLContextInitializer

java.lang.Object
  extended by org.ldaptive.ssl.AbstractSSLContextInitializer
All Implemented Interfaces:
SSLContextInitializer
Direct Known Subclasses:
DefaultSSLContextInitializer, KeyStoreSSLContextInitializer, X509SSLContextInitializer

public abstract class AbstractSSLContextInitializer
extends Object
implements SSLContextInitializer

Provides common implementation for SSL context initializer.

Version:
$Revision: 3243 $ $Date: 2017-09-11 21:58:31 -0400 (Mon, 11 Sep 2017) $
Author:
Middleware Services

Field Summary
protected  HostnameVerifierConfig hostnameVerifierConfig
          Hostname verifier config.
protected  org.slf4j.Logger logger
          Logger for this class.
protected  TrustManager[] trustManagers
          Trust managers.
 
Constructor Summary
AbstractSSLContextInitializer()
           
 
Method Summary
protected  TrustManager[] aggregateTrustManagers(TrustManager... managers)
          Creates an AggregateTrustManager containing the supplied trust managers.
protected abstract  TrustManager[] createTrustManagers()
          Creates any trust managers specific to this context initializer.
 HostnameVerifierConfig getHostnameVerifierConfig()
          Returns the hostname verifier config used when created SSL contexts.
 TrustManager[] getTrustManagers()
          Returns the trust managers used when creating SSL contexts.
 SSLContext initSSLContext(String protocol)
          Creates an initialized SSLContext for the supplied protocol.
 void setHostnameVerifierConfig(HostnameVerifierConfig config)
          Sets the hostname verifier config.
 void setTrustManagers(TrustManager... managers)
          Sets the trust managers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.ldaptive.ssl.SSLContextInitializer
getKeyManagers
 

Field Detail

logger

protected final org.slf4j.Logger logger
Logger for this class.


trustManagers

protected TrustManager[] trustManagers
Trust managers.


hostnameVerifierConfig

protected HostnameVerifierConfig hostnameVerifierConfig
Hostname verifier config.

Constructor Detail

AbstractSSLContextInitializer

public AbstractSSLContextInitializer()
Method Detail

getTrustManagers

public TrustManager[] getTrustManagers()
                                throws GeneralSecurityException
Returns the trust managers used when creating SSL contexts.

Specified by:
getTrustManagers in interface SSLContextInitializer
Returns:
trust managers
Throws:
GeneralSecurityException - if an errors occurs while loading the TrustManagers

setTrustManagers

public void setTrustManagers(TrustManager... managers)
Sets the trust managers.

Specified by:
setTrustManagers in interface SSLContextInitializer
Parameters:
managers - trust managers

getHostnameVerifierConfig

public HostnameVerifierConfig getHostnameVerifierConfig()
Description copied from interface: SSLContextInitializer
Returns the hostname verifier config used when created SSL contexts.

Specified by:
getHostnameVerifierConfig in interface SSLContextInitializer
Returns:
hostname verifier config

setHostnameVerifierConfig

public void setHostnameVerifierConfig(HostnameVerifierConfig config)
Description copied from interface: SSLContextInitializer
Sets the hostname verifier config.

Specified by:
setHostnameVerifierConfig in interface SSLContextInitializer
Parameters:
config - hostname verifier config

createTrustManagers

protected abstract TrustManager[] createTrustManagers()
                                               throws GeneralSecurityException
Creates any trust managers specific to this context initializer.

Returns:
trust managers
Throws:
GeneralSecurityException - if an errors occurs while loading the TrustManagers

initSSLContext

public SSLContext initSSLContext(String protocol)
                          throws GeneralSecurityException
Creates an initialized SSLContext for the supplied protocol.

Specified by:
initSSLContext in interface SSLContextInitializer
Parameters:
protocol - type to use for SSL
Returns:
SSL context
Throws:
GeneralSecurityException - if the SSLContext cannot be created

aggregateTrustManagers

protected TrustManager[] aggregateTrustManagers(TrustManager... managers)
Creates an AggregateTrustManager containing the supplied trust managers.

Parameters:
managers - to aggregate
Returns:
array containing a single aggregate trust manager


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