Top Description Inners Fields Constructors Methods
org.glassfish.grizzly.sni

public Class SNIFilter

extends SSLFilter
Class Inheritance
Static Imports
org.glassfish.grizzly.ssl.SSLUtils.allocateInputBuffer, .SSLUtils.allowDispose, .SSLUtils.getSslConnectionContext

TLS Server Name Indication (SNI) Filter implementation. This filter supports SNI extension on both client and server sides, however the client side logic works on JDK 7+ only. On the server-side this filter allows developers to set custom SSLEngineConfigurator, based on the host name provided by the client in the SSL CLIENT_HELLO message. An SNIServerConfigResolver registered via setServerSSLConfigResolver(org.glassfish.grizzly.sni.SNIServerConfigResolver) would be responsible for customizing SSLEngineConfigurator. On the other hand for client-side it's not mandatory to register SNIClientConfigResolver, because the host name information could be obtained from the Connection#getPeerAddress(). However SNIClientConfigResolver could be used to customize the host name.
Author
Alexey Stashok

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static final int
private SNIClientConfigResolver
private static final byte
private static final Logger
private static final int
private SNIServerConfigResolver
private static final int
Inherited from org.glassfish.grizzly.ssl.SSLFilter:
maxPendingBytes

Constructor Summary

AccessConstructor and Description
public
public
SNIFilter(final SSLEngineConfigurator serverSSLEngineConfigurator, final SSLEngineConfigurator clientSSLEngineConfigurator)

Construct an SNIFilter with the given default client and server side SSLEngineConfigurator.

public
SNIFilter(final SSLEngineConfigurator
SSLEngine configurator for server side connections
serverSSLEngineConfigurator
,
final SSLEngineConfigurator
SSLEngine configurator for client side connections
clientSSLEngineConfigurator
,
final boolean renegotiateOnClientAuthWant)

Construct an SNIFilter with the given default SSLEngineConfigurator.

Method Summary

Modifier and TypeMethod and Description
pack-priv static boolean
checkTlsVersion(final byte byte0, final byte major, final byte minor)

protected SSLBaseFilter.SSLTransportFilterWrapper
public SNIClientConfigResolver
getClientSSLConfigResolver()

Returns: SNIClientConfigResolver, which is responsible for customizing SSLEngineConfigurator and SNI host name to be sent to a server

private String
getHostName(final Buffer input, final int len)

public SNIServerConfigResolver
getServerSSLConfigResolver()

Returns: SNIServerConfigResolver, which is responsible for customizing SSLEngineConfigurator for newly accepted Connections, based on SNI host name information sent by a client

public NextAction
handleConnect(final FilterChainContext ctx)

Overrides org.glassfish.grizzly.filterchain.BaseFilter.handleConnect.

Implements org.glassfish.grizzly.filterchain.Filter.handleConnect.

Execute a unit of processing work to be performed, when channel gets connected.

public NextAction
handleRead(final FilterChainContext ctx)

Overrides org.glassfish.grizzly.ssl.SSLBaseFilter.handleRead.

Implements org.glassfish.grizzly.filterchain.Filter.handleRead.

Execute a unit of processing work to be performed, when channel will become available for reading.

public void
setClientSSLConfigResolver(final SNIClientConfigResolver resolver)

Sets SNIClientConfigResolver, which is responsible for customizing SSLEngineConfigurator and SNI host name to be sent to a server.

public void
setServerSSLConfigResolver(final SNIServerConfigResolver resolver)

Sets SNIServerConfigResolver, which is responsible for customizing SSLEngineConfigurator for newly accepted Connections, based on SNI host name information sent by a client.

Inherited from org.glassfish.grizzly.ssl.SSLFilter:
createClientSSLEnginedoHandshakeStepgetClientSSLEngineConfiguratorgetMaxPendingBytesPerConnectionhandleWritehandshakehandshakehandshakehandshakenotifyHandshakeCompletenotifyHandshakeFailedsetMaxPendingBytesPerConnection

Field Detail

CLIENT_HELLO_HSTback to summary
private static final int CLIENT_HELLO_HST
clientResolverback to summary
private SNIClientConfigResolver clientResolver
HANDSHAKE_TYPEback to summary
private static final byte HANDSHAKE_TYPE
LOGGERback to summary
private static final Logger LOGGER

Hides org.glassfish.grizzly.ssl.SSLFilter.LOGGER.

MIN_TLS_VERSIONback to summary
private static final int MIN_TLS_VERSION
serverResolverback to summary
private SNIServerConfigResolver serverResolver
SSLV3_RECORD_HEADER_SIZEback to summary
private static final int SSLV3_RECORD_HEADER_SIZE

Constructor Detail

SNIFilterback to summary
public SNIFilter()
SNIFilterback to summary
public SNIFilter(final SSLEngineConfigurator serverSSLEngineConfigurator, final SSLEngineConfigurator clientSSLEngineConfigurator)

Construct an SNIFilter with the given default client and server side SSLEngineConfigurator.

SNIFilterback to summary
public SNIFilter(final SSLEngineConfigurator serverSSLEngineConfigurator, final SSLEngineConfigurator clientSSLEngineConfigurator, final boolean renegotiateOnClientAuthWant)

Construct an SNIFilter with the given default SSLEngineConfigurator.

Parameters
serverSSLEngineConfigurator:SSLEngineConfigurator

SSLEngine configurator for server side connections

clientSSLEngineConfigurator:SSLEngineConfigurator

SSLEngine configurator for client side connections

Method Detail

checkTlsVersionback to summary
pack-priv static boolean checkTlsVersion(final byte byte0, final byte major, final byte minor)
createOptimizedTransportFilterback to summary
protected SSLBaseFilter.SSLTransportFilterWrapper createOptimizedTransportFilter(final TransportFilter childFilter)

Overrides org.glassfish.grizzly.ssl.SSLBaseFilter.createOptimizedTransportFilter.

Annotations
@Override
getClientSSLConfigResolverback to summary
public SNIClientConfigResolver getClientSSLConfigResolver()
Returns:SNIClientConfigResolver

SNIClientConfigResolver, which is responsible for customizing SSLEngineConfigurator and SNI host name to be sent to a server

getHostNameback to summary
private String getHostName(final Buffer input, final int len)
getServerSSLConfigResolverback to summary
public SNIServerConfigResolver getServerSSLConfigResolver()
Returns:SNIServerConfigResolver

SNIServerConfigResolver, which is responsible for customizing SSLEngineConfigurator for newly accepted Connections, based on SNI host name information sent by a client

handleConnectback to summary
public NextAction handleConnect(final FilterChainContext ctx) throws IOException

Overrides org.glassfish.grizzly.filterchain.BaseFilter.handleConnect.

Implements org.glassfish.grizzly.filterchain.Filter.handleConnect.

Doc from org.glassfish.grizzly.filterchain.BaseFilter.handleConnect.

Execute a unit of processing work to be performed, when channel gets connected. This Filter may either complete the required processing and return false, or delegate remaining processing to the next Filter in a FilterChain containing this Filter by returning true.

Annotations
@Override
handleReadback to summary
public NextAction handleRead(final FilterChainContext ctx) throws IOException

Overrides org.glassfish.grizzly.ssl.SSLBaseFilter.handleRead.

Implements org.glassfish.grizzly.filterchain.Filter.handleRead.

Doc from org.glassfish.grizzly.filterchain.BaseFilter.handleRead.

Execute a unit of processing work to be performed, when channel will become available for reading. This Filter may either complete the required processing and return false, or delegate remaining processing to the next Filter in a FilterChain containing this Filter by returning true.

Annotations
@Override
setClientSSLConfigResolverback to summary
public void setClientSSLConfigResolver(final SNIClientConfigResolver resolver)

Sets SNIClientConfigResolver, which is responsible for customizing SSLEngineConfigurator and SNI host name to be sent to a server.

setServerSSLConfigResolverback to summary
public void setServerSSLConfigResolver(final SNIServerConfigResolver resolver)

Sets SNIServerConfigResolver, which is responsible for customizing SSLEngineConfigurator for newly accepted Connections, based on SNI host name information sent by a client.

Parameters
resolver:SNIServerConfigResolver

SNIServerConfigResolver

org.glassfish.grizzly.sni back to summary

private final Class SNIFilter.SNIAwareTransportFilterWrapper

extends SSLTransportFilterWrapper
Class Inheritance

Field Summary

Inherited from org.glassfish.grizzly.ssl.SSLBaseFilter.SSLTransportFilterWrapper:
sslBaseFilterwrappedFilter

Constructor Summary

AccessConstructor and Description
public
SNIAwareTransportFilterWrapper(final TransportFilter transportFilter, final SSLBaseFilter sslBaseFilter)

Method Summary

Modifier and TypeMethod and Description
public NextAction
Inherited from org.glassfish.grizzly.ssl.SSLBaseFilter.SSLTransportFilterWrapper:
createContextexceptionOccurredhandleAccepthandleClosehandleConnecthandleEventhandleWriteonAddedonFilterChainChangedonRemoved

Constructor Detail

SNIAwareTransportFilterWrapperback to summary
public SNIAwareTransportFilterWrapper(final TransportFilter transportFilter, final SSLBaseFilter sslBaseFilter)

Method Detail

handleReadback to summary
public NextAction handleRead(final FilterChainContext ctx) throws IOException

Overrides org.glassfish.grizzly.ssl.SSLBaseFilter.SSLTransportFilterWrapper.handleRead.

Implements org.glassfish.grizzly.filterchain.Filter.handleRead.

Doc from org.glassfish.grizzly.filterchain.TransportFilter.handleRead.

Delegates reading operation to Transport's specific transport filter.

Annotations
@Override