use of org.glassfish.grizzly.sni.SNIServerConfigResolver 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;
}
Aggregations