Package org.ldaptive.ssl
Class AbstractSSLContextInitializer
- java.lang.Object
-
- 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.
-
-
Field Summary
Fields Modifier and Type Field Description protected Logger
logger
Logger for this class.protected TrustManager[]
trustManagers
Trust managers.
-
Constructor Summary
Constructors Constructor Description AbstractSSLContextInitializer()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected TrustManager[]
aggregateTrustManagers(TrustManager... managers)
Creates anAggregateTrustManager
containing the supplied trust managers.protected abstract TrustManager[]
createTrustManagers()
Creates any trust managers specific to this context initializer.TrustManager[]
getTrustManagers()
Returns the trust managers used when creating SSL contexts.SSLContext
initSSLContext(String protocol)
Creates an initialized SSLContext for the supplied protocol.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 Logger logger
Logger for this class.
-
trustManagers
protected TrustManager[] trustManagers
Trust managers.
-
-
Method Detail
-
getTrustManagers
public TrustManager[] getTrustManagers() throws GeneralSecurityException
Description copied from interface:SSLContextInitializer
Returns the trust managers used when creating SSL contexts.- Specified by:
getTrustManagers
in interfaceSSLContextInitializer
- Returns:
- trust managers
- Throws:
GeneralSecurityException
- if an errors occurs while loading the TrustManagers
-
setTrustManagers
public void setTrustManagers(TrustManager... managers)
Description copied from interface:SSLContextInitializer
Sets the trust managers. May be in isolation or in conjunction with other trust material.- Specified by:
setTrustManagers
in interfaceSSLContextInitializer
- Parameters:
managers
- trust managers
-
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
Description copied from interface:SSLContextInitializer
Creates an initialized SSLContext for the supplied protocol.- Specified by:
initSSLContext
in interfaceSSLContextInitializer
- 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 anAggregateTrustManager
containing the supplied trust managers.- Parameters:
managers
- to aggregate- Returns:
- array containing a single aggregate trust manager
-
-