Class TLSSocketFactoryBuilder
java.lang.Object
net.shibboleth.utilities.java.support.httpclient.TLSSocketFactoryBuilder
public class TLSSocketFactoryBuilder extends Object
A builder for instances of
TLSSocketFactory
which allows easy specification
of the full range of supported factory inputs.-
Field Summary
Fields Modifier and Type Field Description private static String
DEFAULT_CONTEXT_PROTOCOL
The default protocol used when obtaining the SSLContxt instance.private static HostnameVerifier
DEFAULT_HOSTNAME_VERIFIER
The default hostname verifier used by the socket factory.private List<String>
enabledCipherSuites
The SSL/TLS cipher suites enabled on sockets produced the socket factory.private List<String>
enabledProtocols
The SSL/TLS protocols enabled on sockets produced by the socket factory.private HostnameVerifier
hostnameVerifier
The hostname verifier used by the socket factory.private List<KeyManager>
keyManagers
The list of KeyManagers used when initializing the SSLContext instance.private SecureRandom
secureRandom
The SecureRandom instance used when initializing the SSLContext instance.private String
sslContextProtocol
The protocol used when obtaining the SSLContext instance.private String
sslContextProvider
The JCA provider used when obtaining the SSLContext instance.private List<TrustManager>
trustManagers
The list of TrustManagers used when initializing the SSLContext instance. -
Constructor Summary
Constructors Constructor Description TLSSocketFactoryBuilder()
-
Method Summary
-
Field Details
-
DEFAULT_CONTEXT_PROTOCOL
The default protocol used when obtaining the SSLContxt instance.- See Also:
- Constant Field Values
-
DEFAULT_HOSTNAME_VERIFIER
The default hostname verifier used by the socket factory. -
sslContextProtocol
The protocol used when obtaining the SSLContext instance. -
sslContextProvider
The JCA provider used when obtaining the SSLContext instance. -
keyManagers
The list of KeyManagers used when initializing the SSLContext instance. -
trustManagers
The list of TrustManagers used when initializing the SSLContext instance. -
secureRandom
The SecureRandom instance used when initializing the SSLContext instance. -
hostnameVerifier
The hostname verifier used by the socket factory. -
enabledProtocols
The SSL/TLS protocols enabled on sockets produced by the socket factory. -
enabledCipherSuites
The SSL/TLS cipher suites enabled on sockets produced the socket factory.
-
-
Constructor Details
-
TLSSocketFactoryBuilder
public TLSSocketFactoryBuilder()
-
-
Method Details
-
getSSLContextProtocol
Get the protocol specifier used when obtaining an instance ofSSLContext
viaSSLContext.getInstance(String)
.If not specified, the value "TLS" will be used.
- Returns:
- the protocol, or null
-
setSSLContextProtocol
Set the protocol specifier used when obtaining an instance ofSSLContext
viaSSLContext.getInstance(String)
.If not specified, the value "TLS" will be used.
- Parameters:
protocol
- the protocol, may be null- Returns:
- this builder instance
-
getSSLContextProvider
Get the JCA provider name used when obtaining an instance ofSSLContext
viaSSLContext.getInstance(String, String)
.- Returns:
- the provider namer, or null
-
setSSLContextProvider
Set the JCA provider name used when obtaining an instance ofSSLContext
viaSSLContext.getInstance(String, String)
.- Parameters:
provider
- the provider name, may be null- Returns:
- this builder instance
-
getKeyManagers
Get the list ofKeyManager
s used to initialize theSSLContext
viaSSLContext.init(KeyManager[], TrustManager[], SecureRandom)
.- Returns:
- the list of key managers, or null
-
setKeyManagers
Set the list ofKeyManager
s used to initialize theSSLContext
viaSSLContext.init(KeyManager[], TrustManager[], SecureRandom)
.- Parameters:
managers
- the list of key managers, or null- Returns:
- this builder instance
-
getTrustManagers
Get the list ofTrustManager
s used to initialize theSSLContext
viaSSLContext.init(KeyManager[], TrustManager[], SecureRandom)
.- Returns:
- the list of trust managers, or null
-
setTrustManagers
Set the list ofTrustManager
s used to initialize theSSLContext
viaSSLContext.init(KeyManager[], TrustManager[], SecureRandom)
.- Parameters:
managers
- the list of trust managers, or null- Returns:
- this builder instance
-
getSecureRandom
Get theSecureRandom
instance used to initialize theSSLContext
viaSSLContext.init(KeyManager[], TrustManager[], SecureRandom)
.- Returns:
- the secure random instance, or null
-
setSecureRandom
Set theSecureRandom
instance used to initialize theSSLContext
viaSSLContext.init(KeyManager[], TrustManager[], SecureRandom)
.- Parameters:
random
- the secure random instance, or null- Returns:
- this builder instance
-
getHostnameVerifier
Get theHostnameVerifier
instance used by the socket factory.If not specified, defaults to
TLSSocketFactory.STRICT_HOSTNAME_VERIFIER
.- Returns:
- the hostname verifier, or null
-
setHostnameVerifier
Set theHostnameVerifier
instance used by the socket factory.If not specified, defaults to
TLSSocketFactory.STRICT_HOSTNAME_VERIFIER
.- Parameters:
verifier
- the hostname verifier, or null- Returns:
- this builder instance
-
getEnabledProtocols
Get the list of enabled SSL/TLS protocols on sockets produced by the factory.- Returns:
- the list of protocols, or null
-
setEnabledProtocols
Set the list of enabled SSL/TLS protocols on sockets produced by the factory.- Parameters:
protocols
- the list of protocols, or null- Returns:
- this builder instance
-
getEnabledCipherSuites
Get the list of enabled SSL/TLS cipher suites on sockets produced by the factory.- Returns:
- the list of cipher suites, or null
-
setEnabledCipherSuites
Set the list of enabled SSL/TLS cipher suites on sockets produced by the factory.- Parameters:
cipherSuites
- the list of cipher suites, or null- Returns:
- this builder instance
-
build
Build a new instance ofTLSSocketFactory
, based on the properties specified to this builder instance.- Returns:
- a new socket factory instance
-
buildSSLContext
Build a new instance ofSSLContext
based on the properties specified on this builder instance.- Returns:
- a new SSLContext instance
-