Search in sources :

Example 1 with SNIFilter

use of org.glassfish.grizzly.sni.SNIFilter in project Payara by payara.

the class GenericGrizzlyListener method configureSsl.

protected static Filter configureSsl(final ServiceLocator habitat, final Ssl ssl, final FilterChainBuilder filterChainBuilder) {
    final SSLEngineConfigurator serverConfig = new SSLConfigurator(habitat, ssl);
    Filter sslFilter = null;
    if (Boolean.valueOf(ssl.getSniEnabled())) {
        SNIFilter sniFilter = new SNIFilter(serverConfig, null, isRenegotiateOnClientAuthWant(ssl));
        sniFilter.setHandshakeTimeout(Long.parseLong(ssl.getHandshakeTimeoutMillis()), TimeUnit.MILLISECONDS);
        sniFilter.setServerSSLConfigResolver(new SNIServerConfigResolver() {

            @Override
            public SNIConfig resolve(Connection cnctn, String hostname) {
                if (hostname == null) {
                    return SNIConfig.newServerConfig(serverConfig);
                } else {
                    SSLConfigurator newConfigurator = new SSLConfigurator(habitat, ssl);
                    newConfigurator.setSNICertAlias(hostname);
                    return SNIConfig.newServerConfig(newConfigurator);
                }
            }
        });
        sslFilter = sniFilter;
    } else {
        sslFilter = new SSLBaseFilter(serverConfig, // clientConfig,
        isRenegotiateOnClientAuthWant(ssl));
        ((SSLBaseFilter) sslFilter).setHandshakeTimeout(Long.parseLong(ssl.getHandshakeTimeoutMillis()), TimeUnit.MILLISECONDS);
    }
    filterChainBuilder.add(sslFilter);
    return sslFilter;
}
Also used : PUFilter(org.glassfish.grizzly.portunif.PUFilter) Filter(org.glassfish.grizzly.filterchain.Filter) SNIFilter(org.glassfish.grizzly.sni.SNIFilter) TransportFilter(org.glassfish.grizzly.filterchain.TransportFilter) IdleTimeoutFilter(org.glassfish.grizzly.utils.IdleTimeoutFilter) HttpServerFilter(org.glassfish.grizzly.http.server.HttpServerFilter) CompressionEncodingFilter(org.glassfish.grizzly.http.server.CompressionEncodingFilter) HttpRedirectFilter(org.glassfish.grizzly.config.portunif.HttpRedirectFilter) FileCacheFilter(org.glassfish.grizzly.http.server.FileCacheFilter) SSLBaseFilter(org.glassfish.grizzly.ssl.SSLBaseFilter) ProtocolFilter(org.glassfish.grizzly.config.dom.ProtocolFilter) SSLBaseFilter(org.glassfish.grizzly.ssl.SSLBaseFilter) SNIFilter(org.glassfish.grizzly.sni.SNIFilter) SNIConfig(org.glassfish.grizzly.sni.SNIConfig) SSLEngineConfigurator(org.glassfish.grizzly.ssl.SSLEngineConfigurator) SNIServerConfigResolver(org.glassfish.grizzly.sni.SNIServerConfigResolver) Connection(org.glassfish.grizzly.Connection)

Aggregations

Connection (org.glassfish.grizzly.Connection)1 ProtocolFilter (org.glassfish.grizzly.config.dom.ProtocolFilter)1 HttpRedirectFilter (org.glassfish.grizzly.config.portunif.HttpRedirectFilter)1 Filter (org.glassfish.grizzly.filterchain.Filter)1 TransportFilter (org.glassfish.grizzly.filterchain.TransportFilter)1 CompressionEncodingFilter (org.glassfish.grizzly.http.server.CompressionEncodingFilter)1 FileCacheFilter (org.glassfish.grizzly.http.server.FileCacheFilter)1 HttpServerFilter (org.glassfish.grizzly.http.server.HttpServerFilter)1 PUFilter (org.glassfish.grizzly.portunif.PUFilter)1 SNIConfig (org.glassfish.grizzly.sni.SNIConfig)1 SNIFilter (org.glassfish.grizzly.sni.SNIFilter)1 SNIServerConfigResolver (org.glassfish.grizzly.sni.SNIServerConfigResolver)1 SSLBaseFilter (org.glassfish.grizzly.ssl.SSLBaseFilter)1 SSLEngineConfigurator (org.glassfish.grizzly.ssl.SSLEngineConfigurator)1 IdleTimeoutFilter (org.glassfish.grizzly.utils.IdleTimeoutFilter)1