public class SSLBaseFilter extends BaseFilter
Filter
to operate with SSL encrypted data.Modifier and Type | Class and Description |
---|---|
static class |
SSLBaseFilter.CertificateEvent |
static interface |
SSLBaseFilter.HandshakeListener |
protected static class |
SSLBaseFilter.SSLTransportFilterWrapper |
Modifier and Type | Field and Description |
---|---|
protected static MessageCloner<Buffer> |
COPY_CLONER |
protected Set<SSLBaseFilter.HandshakeListener> |
handshakeListeners |
Constructor and Description |
---|
SSLBaseFilter() |
SSLBaseFilter(SSLEngineConfigurator serverSSLEngineConfigurator)
Build SSLFilter with the given
SSLEngineConfigurator . |
SSLBaseFilter(SSLEngineConfigurator serverSSLEngineConfigurator,
boolean renegotiateOnClientAuthWant)
Build SSLFilter with the given
SSLEngineConfigurator . |
createContext, exceptionOccurred, handleAccept, handleClose, handleConnect, onFilterChainChanged, toString
protected static final MessageCloner<Buffer> COPY_CLONER
protected final Set<SSLBaseFilter.HandshakeListener> handshakeListeners
public SSLBaseFilter()
public SSLBaseFilter(SSLEngineConfigurator serverSSLEngineConfigurator)
SSLEngineConfigurator
.serverSSLEngineConfigurator
- SSLEngine configurator for server side connectionspublic SSLBaseFilter(SSLEngineConfigurator serverSSLEngineConfigurator, boolean renegotiateOnClientAuthWant)
SSLEngineConfigurator
.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 initiatedpublic boolean isRenegotiateOnClientAuthWant()
public SSLEngineConfigurator getServerSSLEngineConfigurator()
SSLEngineConfigurator
used by the filter to create new
SSLEngine
for server-side Connection
spublic void addHandshakeListener(SSLBaseFilter.HandshakeListener listener)
public void removeHandshakeListener(SSLBaseFilter.HandshakeListener listener)
public long getHandshakeTimeout(TimeUnit timeUnit)
timeUnit
- TimeUnit
-1
if blocking handshake mode
is disabled (default).public void setHandshakeTimeout(long handshakeTimeout, TimeUnit timeUnit)
handshakeTimeout
- timeout value, or -1
means for
non-blocking handshake mode.timeUnit
- TimeUnit
protected SSLBaseFilter.SSLTransportFilterWrapper getOptimizedTransportFilter(TransportFilter childFilter)
protected SSLBaseFilter.SSLTransportFilterWrapper createOptimizedTransportFilter(TransportFilter childFilter)
public void onRemoved(FilterChain filterChain)
BaseFilter
FilterChain
.onRemoved
in interface Filter
onRemoved
in class BaseFilter
filterChain
- the FilterChain
this Filter was removed from.public void onAdded(FilterChain filterChain)
BaseFilter
FilterChain
.onAdded
in interface Filter
onAdded
in class BaseFilter
filterChain
- the FilterChain
this Filter was added to.public NextAction handleEvent(FilterChainContext ctx, FilterChainEvent event) throws IOException
BaseFilter
Connection
.
This Filter
may either complete the required processing and
return StopAction
, or delegate remaining processing to the next
Filter
in a FilterChain
containing this Filter
by returning InvokeAction
.handleEvent
in interface Filter
handleEvent
in class BaseFilter
ctx
- FilterChainContext
NextAction
instruction for FilterChain
, how it
should continue the executionIOException
public NextAction handleRead(FilterChainContext ctx) throws IOException
BaseFilter
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.handleRead
in interface Filter
handleRead
in class BaseFilter
ctx
- FilterChainContext
NextAction
instruction for FilterChain
, how it
should continue the executionIOException
public NextAction handleWrite(FilterChainContext ctx) throws IOException
BaseFilter
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.handleWrite
in interface Filter
handleWrite
in class BaseFilter
ctx
- FilterChainContext
NextAction
instruction for FilterChain
, how it
should continue the executionIOException
protected NextAction unwrapAll(FilterChainContext ctx, SSLConnectionContext sslCtx) throws SSLException
SSLException
protected Buffer wrapAll(FilterChainContext ctx, SSLConnectionContext sslCtx) throws SSLException
SSLException
protected Buffer doHandshakeSync(SSLConnectionContext sslCtx, FilterChainContext ctx, Buffer inputBuffer, long timeoutMillis) throws IOException
IOException
protected Buffer doHandshakeStep(SSLConnectionContext sslCtx, FilterChainContext ctx, Buffer inputBuffer) throws IOException
IOException
protected Buffer doHandshakeStep(SSLConnectionContext sslCtx, FilterChainContext ctx, Buffer inputBuffer, Buffer tmpAppBuffer0) throws IOException
IOException
protected void renegotiate(SSLConnectionContext sslCtx, FilterChainContext context) throws IOException
sslCtx
- the SSLConnectionContext
associated with this
this renegotiation request.context
- the FilterChainContext
associated with this
this renegotiation request.IOException
- if an error occurs during SSL renegotiation.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 needClientAuth
is true, an SSL renegotiation
will be be triggered to request the certificates from the client.
sslCtx
- the SSLConnectionContext
associated with this
certificate request.context
- the FilterChainContext
associated 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.protected SSLConnectionContext obtainSslConnectionContext(Connection connection)
protected SSLConnectionContext createSslConnectionContext(Connection connection)
protected void notifyHandshakeStart(Connection connection)
protected void notifyHandshakeComplete(Connection<?> connection, SSLEngine sslEngine)
protected void notifyHandshakeFailed(Connection connection, Throwable t)
Copyright © 2023 Oracle Corporation. All rights reserved.