Class SSLParamConfigurator
- java.lang.Object
-
- org.glassfish.jersey.client.innate.http.SSLParamConfigurator
-
public final class SSLParamConfigurator extends Object
A unified routines to configureSSLParameters. To be reused in connectors.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSSLParamConfigurator.BuilderBuilder of theSSLParamConfiguratorinstance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SSLParamConfigurator.Builderbuilder()Create a new instance of TlsSupport classStringgetSNIHostName()Get the host name either set by the request URI or byHttpHeaders.HOSTheader if it differs from HTTP request host name.URIgetSNIUri()Get the request URI or altered byHttpHeaders.HOSTheader.booleanisSNIRequired()Return true iff SNI is to be set, i.e.voidsetEndpointIdentificationAlgorithm(SSLEngine sslEngine)Set setEndpointIdentificationAlgorithm to HTTPS.voidsetSNIServerName(SSLEngine sslEngine)SetSNIServerNamefor theSSLParameterswhen SNI should be used (i.e.voidsetSNIServerName(SSLParameters parameters)SetSNIServerNamefor theSSLParameterswhen SNI should be used (i.e.voidsetSNIServerName(SSLSocket sslSocket)SetSNIServerNamefor theSSLParameterswhen SNI should be used (i.e.URItoIPRequestUri()Replaces hostname within theClientRequesturi with a resolved IP address.
-
-
-
Method Detail
-
builder
public static SSLParamConfigurator.Builder builder()
Create a new instance of TlsSupport class
-
getSNIHostName
public String getSNIHostName()
Get the host name either set by the request URI or byHttpHeaders.HOSTheader if it differs from HTTP request host name.- Returns:
- the hostName the
SSLEngineis to use.
-
toIPRequestUri
public URI toIPRequestUri()
Replaces hostname within theClientRequesturi with a resolved IP address. Should the hostname be not known, the original request URI is returned. The purpose of this method is to replace the host with the IP so that {code HttpUrlConnection} does not replace user definedSNIHostNamewith the host from the request uri.- Returns:
- the request uri with ip address of the resolved host.
-
isSNIRequired
public boolean isSNIRequired()
Return true iff SNI is to be set, i.e.HttpHeaders.HOSTheader if it differs from HTTP request host name.- Returns:
- Return
truewhenSNIHostNameis to be set.
-
getSNIUri
public URI getSNIUri()
Get the request URI or altered byHttpHeaders.HOSTheader.- Returns:
- The possibly altered request URI.
- See Also:
getSNIHostName()
-
setSNIServerName
public void setSNIServerName(SSLEngine sslEngine)
SetSNIServerNamefor theSSLParameterswhen SNI should be used (i.e.HttpHeaders.HOSTdiffers from HTTP request host name)- Parameters:
sslEngine- theSSLEnginetheSSLParametersare set for.
-
setSNIServerName
public void setSNIServerName(SSLSocket sslSocket)
SetSNIServerNamefor theSSLParameterswhen SNI should be used (i.e.HttpHeaders.HOSTdiffers from HTTP request host name)- Parameters:
sslSocket- theSSLSockettheSSLParametersare set for.
-
setSNIServerName
public void setSNIServerName(SSLParameters parameters)
SetSNIServerNamefor theSSLParameterswhen SNI should be used (i.e.HttpHeaders.HOSTdiffers from HTTP request host name)- Parameters:
parameters- theSSLParametersto be set
-
setEndpointIdentificationAlgorithm
public void setEndpointIdentificationAlgorithm(SSLEngine sslEngine)
Set setEndpointIdentificationAlgorithm to HTTPS. This is to prevent man-in-the-middle attacks.- Parameters:
sslEngine- theSSLEnginethe algorithm is set for.- See Also:
SSLParameters.setEndpointIdentificationAlgorithm(String)
-
-