java.lang.Object
org.glassfish.grizzly.filterchain.BaseFilter
org.glassfish.grizzly.ssl.SSLBaseFilter
- All Implemented Interfaces:
Filter
- Direct Known Subclasses:
SSLFilter
SSL
Filter to operate with SSL encrypted data.- Author:
- Alexey Stashok
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic interfaceprotected static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final MessageCloner<Buffer>protected final Set<SSLBaseFilter.HandshakeListener> -
Constructor Summary
ConstructorsConstructorDescriptionSSLBaseFilter(SSLEngineConfigurator serverSSLEngineConfigurator) Build SSLFilter with the givenSSLEngineConfigurator.SSLBaseFilter(SSLEngineConfigurator serverSSLEngineConfigurator, boolean renegotiateOnClientAuthWant) Build SSLFilter with the givenSSLEngineConfigurator. -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected SSLBaseFilter.SSLTransportFilterWrappercreateOptimizedTransportFilter(TransportFilter childFilter) protected SSLConnectionContextcreateSslConnectionContext(Connection connection) protected BufferdoHandshakeStep(SSLConnectionContext sslCtx, FilterChainContext ctx, Buffer inputBuffer) protected BufferdoHandshakeStep(SSLConnectionContext sslCtx, FilterChainContext ctx, Buffer inputBuffer, Buffer tmpAppBuffer0) protected BufferdoHandshakeSync(SSLConnectionContext sslCtx, FilterChainContext ctx, Buffer inputBuffer, long timeoutMillis) longgetHandshakeTimeout(TimeUnit timeUnit) protected SSLBaseFilter.SSLTransportFilterWrappergetOptimizedTransportFilter(TransportFilter childFilter) protected voidgetPeerCertificateChain(SSLConnectionContext sslCtx, FilterChainContext context, boolean needClientAuth, FutureImpl<Object[]> certFuture) Obtains the certificate chain for this SSL session.handleEvent(FilterChainContext ctx, FilterChainEvent event) Handle custom event associated with theConnection.Execute a unit of processing work to be performed, when channel will become available for reading.Execute a unit of processing work to be performed, when some data should be written on channel.booleanprotected voidnotifyHandshakeComplete(Connection<?> connection, SSLEngine sslEngine) protected voidnotifyHandshakeFailed(Connection connection, Throwable t) protected voidnotifyHandshakeInit(Connection<?> connection, SSLEngine sslEngine) protected voidnotifyHandshakeStart(Connection connection) protected SSLConnectionContextobtainSslConnectionContext(Connection connection) voidonAdded(FilterChain filterChain) Method is called, when the Filter has been added to the passedFilterChain.voidonRemoved(FilterChain filterChain) Method is called, when the Filter has been removed from the passedFilterChain.voidprotected voidrenegotiate(SSLConnectionContext sslCtx, FilterChainContext context) Performs an SSL renegotiation.voidsetHandshakeTimeout(long handshakeTimeout, TimeUnit timeUnit) Sets the handshake timeout.voidsetRenegotiationDisabled(boolean renegotiationDisabled) Completely disables renegotiation.protected NextActionunwrapAll(FilterChainContext ctx, SSLConnectionContext sslCtx) protected BufferwrapAll(FilterChainContext ctx, SSLConnectionContext sslCtx) Methods inherited from class org.glassfish.grizzly.filterchain.BaseFilter
createContext, exceptionOccurred, handleAccept, handleClose, handleConnect, onFilterChainChanged, toString
-
Field Details
-
COPY_CLONER
-
handshakeListeners
-
-
Constructor Details
-
SSLBaseFilter
public SSLBaseFilter() -
SSLBaseFilter
Build SSLFilter with the givenSSLEngineConfigurator.- Parameters:
serverSSLEngineConfigurator- SSLEngine configurator for server side connections
-
SSLBaseFilter
public SSLBaseFilter(SSLEngineConfigurator serverSSLEngineConfigurator, boolean renegotiateOnClientAuthWant) Build SSLFilter with the givenSSLEngineConfigurator.- Parameters:
serverSSLEngineConfigurator- SSLEngine configurator for server side connectionsrenegotiateOnClientAuthWant- true, if SSLBaseFilter has to force client authentication during re-handshake, in case the client didn't send its credentials during the initial handshake in response to "wantClientAuth" flag. In this case "needClientAuth" flag will be raised and re-handshake will be initiated
-
-
Method Details
-
isRenegotiateOnClientAuthWant
public boolean isRenegotiateOnClientAuthWant()- Returns:
- true, if SSLBaseFilter has to force client authentication during re-handshake, in case the client didn't send its credentials during the initial handshake in response to "wantClientAuth" flag. In this case "needClientAuth" flag will be raised and re-handshake will be initiated
-
getServerSSLEngineConfigurator
- Returns:
SSLEngineConfiguratorused by the filter to create newSSLEnginefor server-sideConnections
-
addHandshakeListener
-
removeHandshakeListener
-
getHandshakeTimeout
- Parameters:
timeUnit-TimeUnit- Returns:
- the handshake timeout,
-1if blocking handshake mode is disabled (default).
-
setHandshakeTimeout
Sets the handshake timeout.- Parameters:
handshakeTimeout- timeout value, or-1means for non-blocking handshake mode.timeUnit-TimeUnit
-
setRenegotiationDisabled
public void setRenegotiationDisabled(boolean renegotiationDisabled) Completely disables renegotiation.- Parameters:
renegotiationDisabled-trueto disable renegotiation.
-
getOptimizedTransportFilter
protected SSLBaseFilter.SSLTransportFilterWrapper getOptimizedTransportFilter(TransportFilter childFilter) -
createOptimizedTransportFilter
protected SSLBaseFilter.SSLTransportFilterWrapper createOptimizedTransportFilter(TransportFilter childFilter) -
onRemoved
Description copied from class:BaseFilterMethod is called, when the Filter has been removed from the passedFilterChain.- Specified by:
onRemovedin interfaceFilter- Overrides:
onRemovedin classBaseFilter- Parameters:
filterChain- theFilterChainthis Filter was removed from.
-
onAdded
Description copied from class:BaseFilterMethod is called, when the Filter has been added to the passedFilterChain.- Specified by:
onAddedin interfaceFilter- Overrides:
onAddedin classBaseFilter- Parameters:
filterChain- theFilterChainthis Filter was added to.
-
handleEvent
Description copied from class:BaseFilterHandle custom event associated with theConnection. ThisFiltermay either complete the required processing and returnStopAction, or delegate remaining processing to the nextFilterin aFilterChaincontaining thisFilterby returningInvokeAction.- Specified by:
handleEventin interfaceFilter- Overrides:
handleEventin classBaseFilter- Parameters:
ctx-FilterChainContext- Returns:
NextActioninstruction forFilterChain, how it should continue the execution- Throws:
IOException
-
handleRead
Description copied from class:BaseFilterExecute a unit of processing work to be performed, when channel will become available for reading. ThisFiltermay either complete the required processing and return false, or delegate remaining processing to the nextFilterin aFilterChaincontaining thisFilterby returning true.- Specified by:
handleReadin interfaceFilter- Overrides:
handleReadin classBaseFilter- Parameters:
ctx-FilterChainContext- Returns:
NextActioninstruction forFilterChain, how it should continue the execution- Throws:
IOException
-
handleWrite
Description copied from class:BaseFilterExecute a unit of processing work to be performed, when some data should be written on channel. ThisFiltermay either complete the required processing and return false, or delegate remaining processing to the nextFilterin aFilterChaincontaining thisFilterby returning true.- Specified by:
handleWritein interfaceFilter- Overrides:
handleWritein classBaseFilter- Parameters:
ctx-FilterChainContext- Returns:
NextActioninstruction forFilterChain, how it should continue the execution- Throws:
IOException
-
unwrapAll
protected NextAction unwrapAll(FilterChainContext ctx, SSLConnectionContext sslCtx) throws SSLException - Throws:
SSLException
-
wrapAll
- Throws:
SSLException
-
doHandshakeSync
protected Buffer doHandshakeSync(SSLConnectionContext sslCtx, FilterChainContext ctx, Buffer inputBuffer, long timeoutMillis) throws IOException - Throws:
IOException
-
doHandshakeStep
protected Buffer doHandshakeStep(SSLConnectionContext sslCtx, FilterChainContext ctx, Buffer inputBuffer) throws IOException - Throws:
IOException
-
doHandshakeStep
protected Buffer doHandshakeStep(SSLConnectionContext sslCtx, FilterChainContext ctx, Buffer inputBuffer, Buffer tmpAppBuffer0) throws IOException - Throws:
IOException
-
renegotiate
protected void renegotiate(SSLConnectionContext sslCtx, FilterChainContext context) throws IOException Performs an SSL renegotiation.- Parameters:
sslCtx- theSSLConnectionContextassociated with this this renegotiation request.context- theFilterChainContextassociated with this this renegotiation request.- Throws:
IOException- if an error occurs during SSL renegotiation.
-
getPeerCertificateChain
protected void getPeerCertificateChain(SSLConnectionContext sslCtx, FilterChainContext context, boolean needClientAuth, FutureImpl<Object[]> certFuture) Obtains the certificate chain for this SSL session. If no certificates are available, and
needClientAuthis true, an SSL renegotiation will be be triggered to request the certificates from the client.- Parameters:
sslCtx- theSSLConnectionContextassociated with this certificate request.context- theFilterChainContextassociated with this this certificate request.needClientAuth- determines whether or not SSL renegotiation will be attempted to obtain the certificate chain.certFuture- the future that will be provided the result of the peer certificate processing.
-
obtainSslConnectionContext
-
createSslConnectionContext
-
notifyHandshakeInit
-
notifyHandshakeStart
-
notifyHandshakeComplete
-
notifyHandshakeFailed
-