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

public Class SSLFilter

extends SSLBaseFilter
Class Inheritance
Static Imports
org.glassfish.grizzly.ssl.SSLUtils.isHandshaking

SSL Filter to operate with SSL encrypted data.
Author
Alexey Stashok

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
SSLFilter.ConnectionCloseListener

References Deprecated GenericCloseListener is deprecated or references (maybe indirectly) at least one deprecated element.
Close listener, which is used to notify handshake completion handler about failure, if Connection will be unexpectedly closed.
private static class
SSLFilter.HostNameResolver

The static class is used as JDK 1.7+ guard and shouldn't be initialized by JDK 1.6.x at runtime, because one of the methods is only available since 1.7.

private class

Field Summary

Modifier and TypeField and Description
private final SSLEngineConfigurator
private final SSLFilter.ConnectionCloseListener
closeListener

References Deprecated SSLFilter.ConnectionCloseListener is deprecated or references (maybe indirectly) at least one deprecated element.
private final Attribute<SSLFilter.SSLHandshakeContext>
private static final Logger
protected volatile int
Inherited from org.glassfish.grizzly.ssl.SSLBaseFilter:
COPY_CLONERhandshakeListeners

Constructor Summary

AccessConstructor and Description
public
public
SSLFilter(SSLEngineConfigurator
SSLEngine configurator for server side connections
serverSSLEngineConfigurator
,
SSLEngineConfigurator
SSLEngine configurator for client side connections
clientSSLEngineConfigurator
)

Build SSLFilter with the given SSLEngineConfigurator.

public
SSLFilter(SSLEngineConfigurator
SSLEngine configurator for server side connections
serverSSLEngineConfigurator
,
SSLEngineConfigurator
SSLEngine configurator for client side connections
clientSSLEngineConfigurator
,
boolean
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
renegotiateOnClientAuthWant
)

Build SSLFilter with the given SSLEngineConfigurator.

Method Summary

Modifier and TypeMethod and Description
private NextAction
accurateWrite(final FilterChainContext ctx, final boolean isHandshakeComplete)

Has to be called in synchronized(connection) {...} block.

protected SSLEngine
createClientSSLEngine(final SSLConnectionContext sslCtx, final SSLEngineConfigurator sslEngineConfigurator)

protected Buffer
doHandshakeStep(final SSLConnectionContext sslCtx, final FilterChainContext ctx, final Buffer inputBuffer, final Buffer tmpAppBuffer0)

Overrides org.glassfish.grizzly.ssl.SSLBaseFilter.doHandshakeStep.

public SSLEngineConfigurator
getClientSSLEngineConfigurator()

Returns: SSLEngineConfigurator used by the filter to create new SSLEngine for client-side Connections

public int
getMaxPendingBytesPerConnection()

Returns: the maximum number of bytes that may be queued to be written to a particular Connection.

public NextAction
handleWrite(final FilterChainContext ctx)

Overrides org.glassfish.grizzly.ssl.SSLBaseFilter.handleWrite.

Implements org.glassfish.grizzly.filterchain.Filter.handleWrite.

Execute a unit of processing work to be performed, when some data should be written on channel.

public void
handshake(final Connection<L> connection, final CompletionHandler<SSLEngine> completionHandler)

public void
handshake(final Connection<L> connection, final CompletionHandler<SSLEngine> completionHandler, final Object dstAddress)

public void
handshake(final Connection<L> connection, final CompletionHandler<SSLEngine> completionHandler, final Object dstAddress, final SSLEngineConfigurator sslEngineConfigurator)

protected void
handshake(final Connection<?> connection, final CompletionHandler<SSLEngine> completionHandler, final Object dstAddress, final SSLEngineConfigurator sslEngineConfigurator, final FilterChainContext context, final boolean forceBeginHandshake)

protected void
protected void
public void
setMaxPendingBytesPerConnection(final int
maximum number of bytes that may be queued to be written for a particular Connection
maxPendingBytes
)

Configures the maximum number of bytes that may be queued to be written for a particular Connection.

Inherited from org.glassfish.grizzly.ssl.SSLBaseFilter:
addHandshakeListenercreateOptimizedTransportFiltercreateSslConnectionContextdoHandshakeStepdoHandshakeSyncgetHandshakeTimeoutgetOptimizedTransportFiltergetPeerCertificateChaingetServerSSLEngineConfiguratorhandleEventhandleReadisRenegotiateOnClientAuthWantnotifyHandshakeInitnotifyHandshakeStartobtainSslConnectionContextonAddedonRemovedremoveHandshakeListenerrenegotiatesetHandshakeTimeoutsetRenegotiationDisabledunwrapAllwrapAll

Field Detail

clientSSLEngineConfiguratorback to summary
private final SSLEngineConfigurator clientSSLEngineConfigurator
closeListenerback to summary
private final SSLFilter.ConnectionCloseListener closeListener

References Deprecated

SSLFilter.ConnectionCloseListener is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

handshakeContextAttrback to summary
private final Attribute<SSLFilter.SSLHandshakeContext> handshakeContextAttr
LOGGERback to summary
private static final Logger LOGGER

Hides org.glassfish.grizzly.ssl.SSLBaseFilter.LOGGER.

maxPendingBytesback to summary
protected volatile int maxPendingBytes

Constructor Detail

SSLFilterback to summary
public SSLFilter()
SSLFilterback to summary
public SSLFilter(SSLEngineConfigurator serverSSLEngineConfigurator, SSLEngineConfigurator clientSSLEngineConfigurator)

Build SSLFilter with the given SSLEngineConfigurator.

Parameters
serverSSLEngineConfigurator:SSLEngineConfigurator

SSLEngine configurator for server side connections

clientSSLEngineConfigurator:SSLEngineConfigurator

SSLEngine configurator for client side connections

SSLFilterback to summary
public SSLFilter(SSLEngineConfigurator serverSSLEngineConfigurator, SSLEngineConfigurator clientSSLEngineConfigurator, boolean renegotiateOnClientAuthWant)

Build SSLFilter with the given SSLEngineConfigurator.

Parameters
serverSSLEngineConfigurator:SSLEngineConfigurator

SSLEngine configurator for server side connections

clientSSLEngineConfigurator:SSLEngineConfigurator

SSLEngine configurator for client side connections

renegotiateOnClientAuthWant:boolean

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 Detail

accurateWriteback to summary
private NextAction accurateWrite(final FilterChainContext ctx, final boolean isHandshakeComplete) throws IOException

Has to be called in synchronized(connection) {...} block.

createClientSSLEngineback to summary
protected SSLEngine createClientSSLEngine(final SSLConnectionContext sslCtx, final SSLEngineConfigurator sslEngineConfigurator)
doHandshakeStepback to summary
protected Buffer doHandshakeStep(final SSLConnectionContext sslCtx, final FilterChainContext ctx, final Buffer inputBuffer, final Buffer tmpAppBuffer0) throws IOException

Overrides org.glassfish.grizzly.ssl.SSLBaseFilter.doHandshakeStep.

Annotations
@Override
getClientSSLEngineConfiguratorback to summary
public SSLEngineConfigurator getClientSSLEngineConfigurator()
Returns:SSLEngineConfigurator

SSLEngineConfigurator used by the filter to create new SSLEngine for client-side Connections

getMaxPendingBytesPerConnectionback to summary
public int getMaxPendingBytesPerConnection()
Returns:int

the maximum number of bytes that may be queued to be written to a particular Connection. This value is related to the situation when we try to send application data before SSL handshake completes, so the data should be stored and sent on wire once handshake will be completed.

handleWriteback to summary
public NextAction handleWrite(final FilterChainContext ctx) throws IOException

Overrides org.glassfish.grizzly.ssl.SSLBaseFilter.handleWrite.

Implements org.glassfish.grizzly.filterchain.Filter.handleWrite.

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

Execute a unit of processing work to be performed, when some data should be written on channel. 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
handshakeback to summary
public void handshake(final Connection<L> connection, final CompletionHandler<SSLEngine> completionHandler) throws IOException
handshakeback to summary
public void handshake(final Connection<L> connection, final CompletionHandler<SSLEngine> completionHandler, final Object dstAddress) throws IOException
handshakeback to summary
public void handshake(final Connection<L> connection, final CompletionHandler<SSLEngine> completionHandler, final Object dstAddress, final SSLEngineConfigurator sslEngineConfigurator) throws IOException
handshakeback to summary
protected void handshake(final Connection<?> connection, final CompletionHandler<SSLEngine> completionHandler, final Object dstAddress, final SSLEngineConfigurator sslEngineConfigurator, final FilterChainContext context, final boolean forceBeginHandshake) throws IOException
notifyHandshakeCompleteback to summary
protected void notifyHandshakeComplete(final Connection<?> connection, final SSLEngine sslEngine)

Overrides org.glassfish.grizzly.ssl.SSLBaseFilter.notifyHandshakeComplete.

Annotations
@Override
notifyHandshakeFailedback to summary
protected void notifyHandshakeFailed(Connection<L> connection, Throwable t)

Overrides org.glassfish.grizzly.ssl.SSLBaseFilter.notifyHandshakeFailed.

Annotations
@Override
setMaxPendingBytesPerConnectionback to summary
public void setMaxPendingBytesPerConnection(final int maxPendingBytes)

Configures the maximum number of bytes that may be queued to be written for a particular Connection. This value is related to the situation when we try to send application data before SSL handshake completes, so the data should be stored and sent on wire once handshake will be completed.

Parameters
maxPendingBytes:int

maximum number of bytes that may be queued to be written for a particular Connection

org.glassfish.grizzly.ssl back to summary

private final Class SSLFilter.ConnectionCloseListener

extends Object
implements GenericCloseListener
Class Inheritance
All Implemented Interfaces
org.glassfish.grizzly.GenericCloseListener, org.glassfish.grizzly.CloseListener

References Deprecated

GenericCloseListener is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Close listener, which is used to notify handshake completion handler about failure, if Connection will be unexpectedly closed.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
onClosed(final Closeable closeable, final CloseType type)

Implements org.glassfish.grizzly.CloseListener.onClosed.

References Deprecated CloseType is deprecated or references (maybe indirectly) at least one deprecated element.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ConnectionCloseListenerback to summary
private ConnectionCloseListener()

Method Detail

onClosedback to summary
public void onClosed(final Closeable closeable, final CloseType type) throws IOException

Implements org.glassfish.grizzly.CloseListener.onClosed.

References Deprecated

CloseType is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Annotations
@Override
org.glassfish.grizzly.ssl back to summary

private Class SSLFilter.HostNameResolver

extends Object
Class Inheritance

The static class is used as JDK 1.7+ guard and shouldn't be initialized by JDK 1.6.x at runtime, because one of the methods is only available since 1.7.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static String
getPeerHostName(final Connection<?> connection)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

HostNameResolverback to summary
private HostNameResolver()

Method Detail

getPeerHostNameback to summary
public static String getPeerHostName(final Connection<?> connection)
org.glassfish.grizzly.ssl back to summary

private final Class SSLFilter.SSLHandshakeContext

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private CompletionHandler<SSLEngine>
private final Connection<L>
private Throwable
private boolean
private List<FilterChainContext>
private int

Constructor Summary

AccessConstructor and Description
public
SSLHandshakeContext(final Connection<L> connection, final CompletionHandler<SSLEngine> completionHandler)

Method Summary

Modifier and TypeMethod and Description
public boolean
add(FilterChainContext context)

Has to be called in synchronized(connection) {...} scope.

public void
completed(final SSLEngine engine)

public void
failed(final Throwable throwable)

private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

completionHandlerback to summary
private CompletionHandler<SSLEngine> completionHandler
connectionback to summary
private final Connection<L> connection
errorback to summary
private Throwable error
isCompleteback to summary
private boolean isComplete
pendingWriteContextsback to summary
private List<FilterChainContext> pendingWriteContexts
sizeInBytesback to summary
private int sizeInBytes

Constructor Detail

SSLHandshakeContextback to summary
public SSLHandshakeContext(final Connection<L> connection, final CompletionHandler<SSLEngine> completionHandler)

Method Detail

addback to summary
public boolean add(FilterChainContext context) throws IOException

Has to be called in synchronized(connection) {...} scope.

completedback to summary
public void completed(final SSLEngine engine)
failedback to summary
public void failed(final Throwable throwable)
resumePendingWritesback to summary
private void resumePendingWrites()