Package org.glassfish.grizzly.sni
Class SNIFilter
java.lang.Object
org.glassfish.grizzly.filterchain.BaseFilter
org.glassfish.grizzly.ssl.SSLBaseFilter
org.glassfish.grizzly.ssl.SSLFilter
org.glassfish.grizzly.sni.SNIFilter
- All Implemented Interfaces:
org.glassfish.grizzly.filterchain.Filter
public class SNIFilter
extends org.glassfish.grizzly.ssl.SSLFilter
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 Class Summary
Nested classes/interfaces inherited from class org.glassfish.grizzly.ssl.SSLBaseFilter
org.glassfish.grizzly.ssl.SSLBaseFilter.CertificateEvent, org.glassfish.grizzly.ssl.SSLBaseFilter.HandshakeListener, org.glassfish.grizzly.ssl.SSLBaseFilter.SSLTransportFilterWrapper -
Field Summary
Fields inherited from class org.glassfish.grizzly.ssl.SSLFilter
maxPendingBytesFields inherited from class org.glassfish.grizzly.ssl.SSLBaseFilter
COPY_CLONER, handshakeListeners -
Constructor Summary
ConstructorsConstructorDescriptionSNIFilter(org.glassfish.grizzly.ssl.SSLEngineConfigurator serverSSLEngineConfigurator, org.glassfish.grizzly.ssl.SSLEngineConfigurator clientSSLEngineConfigurator) Construct an SNIFilter with the given default client and server sideSSLEngineConfigurator.SNIFilter(org.glassfish.grizzly.ssl.SSLEngineConfigurator serverSSLEngineConfigurator, org.glassfish.grizzly.ssl.SSLEngineConfigurator clientSSLEngineConfigurator, boolean renegotiateOnClientAuthWant) Construct an SNIFilter with the given defaultSSLEngineConfigurator. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.glassfish.grizzly.ssl.SSLBaseFilter.SSLTransportFilterWrappercreateOptimizedTransportFilter(org.glassfish.grizzly.filterchain.TransportFilter childFilter) org.glassfish.grizzly.filterchain.NextActionhandleConnect(org.glassfish.grizzly.filterchain.FilterChainContext ctx) org.glassfish.grizzly.filterchain.NextActionhandleRead(org.glassfish.grizzly.filterchain.FilterChainContext ctx) voidSetsSNIClientConfigResolver, which is responsible for customizingSSLEngineConfiguratorand SNI host name to be sent to a server.voidSetsSNIServerConfigResolver, which is responsible for customizingSSLEngineConfiguratorfor newly acceptedConnections, based on SNI host name information sent by a client.Methods inherited from class org.glassfish.grizzly.ssl.SSLFilter
createClientSSLEngine, doHandshakeStep, getClientSSLEngineConfigurator, getMaxPendingBytesPerConnection, handleWrite, handshake, handshake, handshake, handshake, notifyHandshakeComplete, notifyHandshakeFailed, setMaxPendingBytesPerConnectionMethods inherited from class org.glassfish.grizzly.ssl.SSLBaseFilter
addHandshakeListener, createSslConnectionContext, doHandshakeStep, doHandshakeSync, getHandshakeTimeout, getOptimizedTransportFilter, getPeerCertificateChain, getServerSSLEngineConfigurator, handleEvent, isRenegotiateOnClientAuthWant, notifyHandshakeInit, notifyHandshakeStart, obtainSslConnectionContext, onAdded, onRemoved, removeHandshakeListener, renegotiate, setHandshakeTimeout, setRenegotiationDisabled, unwrapAll, wrapAllMethods inherited from class org.glassfish.grizzly.filterchain.BaseFilter
createContext, exceptionOccurred, handleAccept, handleClose, onFilterChainChanged, toString
-
Constructor Details
-
SNIFilter
public SNIFilter() -
SNIFilter
public SNIFilter(org.glassfish.grizzly.ssl.SSLEngineConfigurator serverSSLEngineConfigurator, org.glassfish.grizzly.ssl.SSLEngineConfigurator clientSSLEngineConfigurator) Construct an SNIFilter with the given default client and server sideSSLEngineConfigurator.- Parameters:
serverSSLEngineConfigurator-clientSSLEngineConfigurator-
-
SNIFilter
public SNIFilter(org.glassfish.grizzly.ssl.SSLEngineConfigurator serverSSLEngineConfigurator, org.glassfish.grizzly.ssl.SSLEngineConfigurator clientSSLEngineConfigurator, boolean renegotiateOnClientAuthWant) Construct an SNIFilter with the given defaultSSLEngineConfigurator.- Parameters:
serverSSLEngineConfigurator- SSLEngine configurator for server side connectionsclientSSLEngineConfigurator- SSLEngine configurator for client side connectionsrenegotiateOnClientAuthWant-
-
-
Method Details
-
getServerSSLConfigResolver
- Returns:
SNIServerConfigResolver, which is responsible for customizingSSLEngineConfiguratorfor newly acceptedConnections, based on SNI host name information sent by a client
-
setServerSSLConfigResolver
SetsSNIServerConfigResolver, which is responsible for customizingSSLEngineConfiguratorfor newly acceptedConnections, based on SNI host name information sent by a client.- Parameters:
resolver-SNIServerConfigResolver
-
getClientSSLConfigResolver
- Returns:
SNIClientConfigResolver, which is responsible for customizingSSLEngineConfiguratorand SNI host name to be sent to a server
-
setClientSSLConfigResolver
SetsSNIClientConfigResolver, which is responsible for customizingSSLEngineConfiguratorand SNI host name to be sent to a server.- Parameters:
resolver-
-
createOptimizedTransportFilter
protected org.glassfish.grizzly.ssl.SSLBaseFilter.SSLTransportFilterWrapper createOptimizedTransportFilter(org.glassfish.grizzly.filterchain.TransportFilter childFilter) - Overrides:
createOptimizedTransportFilterin classorg.glassfish.grizzly.ssl.SSLBaseFilter
-
handleConnect
public org.glassfish.grizzly.filterchain.NextAction handleConnect(org.glassfish.grizzly.filterchain.FilterChainContext ctx) throws IOException - Specified by:
handleConnectin interfaceorg.glassfish.grizzly.filterchain.Filter- Overrides:
handleConnectin classorg.glassfish.grizzly.filterchain.BaseFilter- Throws:
IOException
-
handleRead
public org.glassfish.grizzly.filterchain.NextAction handleRead(org.glassfish.grizzly.filterchain.FilterChainContext ctx) throws IOException - Specified by:
handleReadin interfaceorg.glassfish.grizzly.filterchain.Filter- Overrides:
handleReadin classorg.glassfish.grizzly.ssl.SSLBaseFilter- Throws:
IOException
-