Package net.shibboleth.shared.httpclient
Class TLSSocketFactoryBuilder
java.lang.Object
net.shibboleth.shared.httpclient.TLSSocketFactoryBuilder
A builder for instances of
TLSSocketFactory which allows easy specification
of the full range of supported factory inputs.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringThe default protocol used when obtaining the SSLContxt instance.private static final HostnameVerifierThe default hostname verifier used by the socket factory.The SSL/TLS cipher suites enabled on sockets produced the socket factory.The SSL/TLS protocols enabled on sockets produced by the socket factory.private HostnameVerifierThe hostname verifier used by the socket factory.private List<KeyManager>The list of KeyManagers used when initializing the SSLContext instance.private SecureRandomThe SecureRandom instance used when initializing the SSLContext instance.private StringThe protocol used when obtaining the SSLContext instance.private StringThe JCA provider used when obtaining the SSLContext instance.private List<TrustManager>The list of TrustManagers used when initializing the SSLContext instance. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Build a new instance ofTLSSocketFactory, based on the properties specified to this builder instance.protected SSLContextBuild a new instance ofSSLContextbased on the properties specified on this builder instance.Get the list of enabled SSL/TLS cipher suites on sockets produced by the factory.Get the list of enabled SSL/TLS protocols on sockets produced by the factory.Get theHostnameVerifierinstance used by the socket factory.Get the list ofKeyManagers used to initialize theSSLContextviaSSLContext.init(KeyManager[], TrustManager[], SecureRandom).Get theSecureRandominstance used to initialize theSSLContextviaSSLContext.init(KeyManager[], TrustManager[], SecureRandom).Get the protocol specifier used when obtaining an instance ofSSLContextviaSSLContext.getInstance(String).Get the JCA provider name used when obtaining an instance ofSSLContextviaSSLContext.getInstance(String, String).Get the list ofTrustManagers used to initialize theSSLContextviaSSLContext.init(KeyManager[], TrustManager[], SecureRandom).setEnabledCipherSuites(List<String> cipherSuites) Set the list of enabled SSL/TLS cipher suites on sockets produced by the factory.setEnabledProtocols(List<String> protocols) Set the list of enabled SSL/TLS protocols on sockets produced by the factory.setHostnameVerifier(HostnameVerifier verifier) Set theHostnameVerifierinstance used by the socket factory.setKeyManagers(List<KeyManager> managers) Set the list ofKeyManagers used to initialize theSSLContextviaSSLContext.init(KeyManager[], TrustManager[], SecureRandom).setSecureRandom(SecureRandom random) Set theSecureRandominstance used to initialize theSSLContextviaSSLContext.init(KeyManager[], TrustManager[], SecureRandom).setSSLContextProtocol(String protocol) Set the protocol specifier used when obtaining an instance ofSSLContextviaSSLContext.getInstance(String).setSSLContextProvider(String provider) Set the JCA provider name used when obtaining an instance ofSSLContextviaSSLContext.getInstance(String, String).setTrustManagers(List<TrustManager> managers) Set the list ofTrustManagers used to initialize theSSLContextviaSSLContext.init(KeyManager[], TrustManager[], SecureRandom).
-
Field Details
-
DEFAULT_CONTEXT_PROTOCOL
The default protocol used when obtaining the SSLContxt instance.- See Also:
-
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 ofSSLContextviaSSLContext.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 ofSSLContextviaSSLContext.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 ofSSLContextviaSSLContext.getInstance(String, String).- Returns:
- the provider namer, or null
-
setSSLContextProvider
Set the JCA provider name used when obtaining an instance ofSSLContextviaSSLContext.getInstance(String, String).- Parameters:
provider- the provider name, may be null- Returns:
- this builder instance
-
getKeyManagers
Get the list ofKeyManagers used to initialize theSSLContextviaSSLContext.init(KeyManager[], TrustManager[], SecureRandom).- Returns:
- the list of key managers, or null
-
setKeyManagers
Set the list ofKeyManagers used to initialize theSSLContextviaSSLContext.init(KeyManager[], TrustManager[], SecureRandom).- Parameters:
managers- the list of key managers, or null- Returns:
- this builder instance
-
getTrustManagers
Get the list ofTrustManagers used to initialize theSSLContextviaSSLContext.init(KeyManager[], TrustManager[], SecureRandom).- Returns:
- the list of trust managers, or null
-
setTrustManagers
Set the list ofTrustManagers used to initialize theSSLContextviaSSLContext.init(KeyManager[], TrustManager[], SecureRandom).- Parameters:
managers- the list of trust managers, or null- Returns:
- this builder instance
-
getSecureRandom
Get theSecureRandominstance used to initialize theSSLContextviaSSLContext.init(KeyManager[], TrustManager[], SecureRandom).- Returns:
- the secure random instance, or null
-
setSecureRandom
Set theSecureRandominstance used to initialize theSSLContextviaSSLContext.init(KeyManager[], TrustManager[], SecureRandom).- Parameters:
random- the secure random instance, or null- Returns:
- this builder instance
-
getHostnameVerifier
Get theHostnameVerifierinstance used by the socket factory.If not specified, defaults to
TLSSocketFactory.STRICT_HOSTNAME_VERIFIER.- Returns:
- the hostname verifier, or null
-
setHostnameVerifier
Set theHostnameVerifierinstance 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 ofSSLContextbased on the properties specified on this builder instance.- Returns:
- a new SSLContext instance
-