use of org.apache.tomcat.util.net.SSLHostConfig in project tomcat by apache.
the class ConnectorSF method storeChildren.
@Override
public void storeChildren(PrintWriter aWriter, int indent, Object aConnector, StoreDescription parentDesc) throws Exception {
if (aConnector instanceof Connector) {
Connector connector = (Connector) aConnector;
// Store nested <Listener> elements
LifecycleListener[] listeners = connector.findLifecycleListeners();
storeElementArray(aWriter, indent, listeners);
// Store nested <UpgradeProtocol> elements
UpgradeProtocol[] upgradeProtocols = connector.findUpgradeProtocols();
storeElementArray(aWriter, indent, upgradeProtocols);
// Store nested <SSLHostConfig> elements
SSLHostConfig[] hostConfigs = connector.findSslHostConfigs();
storeElementArray(aWriter, indent, hostConfigs);
}
}
use of org.apache.tomcat.util.net.SSLHostConfig in project tomcat by apache.
the class AbstractHttp11Protocol method registerDefaultSSLHostConfig.
private void registerDefaultSSLHostConfig() {
if (defaultSSLHostConfig == null) {
defaultSSLHostConfig = new SSLHostConfig();
defaultSSLHostConfig.setHostName(getDefaultSSLHostConfigName());
getEndpoint().addSslHostConfig(defaultSSLHostConfig);
}
}
use of org.apache.tomcat.util.net.SSLHostConfig in project tomcat by apache.
the class ManagerServlet method getConnectorCiphers.
protected Map<String, Set<String>> getConnectorCiphers() {
Map<String, Set<String>> result = new HashMap<>();
Engine e = (Engine) host.getParent();
Service s = e.getService();
Connector[] connectors = s.findConnectors();
for (Connector connector : connectors) {
if (Boolean.TRUE.equals(connector.getProperty("SSLEnabled"))) {
SSLHostConfig[] sslHostConfigs = connector.getProtocolHandler().findSslHostConfigs();
for (SSLHostConfig sslHostConfig : sslHostConfigs) {
String name = connector.toString() + "-" + sslHostConfig.getHostName();
Set<String> cipherList = new HashSet<>();
String[] cipherNames = sslHostConfig.getEnabledCiphers();
for (String cipherName : cipherNames) {
cipherList.add(cipherName);
}
result.put(name, cipherList);
}
} else {
Set<String> cipherList = new HashSet<>();
cipherList.add(sm.getString("managerServlet.notSslConnector"));
result.put(connector.toString(), cipherList);
}
}
return result;
}
use of org.apache.tomcat.util.net.SSLHostConfig in project tomcat by apache.
the class CertificateCreateRule method begin.
@Override
public void begin(String namespace, String name, Attributes attributes) throws Exception {
SSLHostConfig sslHostConfig = (SSLHostConfig) digester.peek();
Type type;
String typeValue = attributes.getValue("type");
if (typeValue == null || typeValue.length() == 0) {
type = Type.UNDEFINED;
} else {
type = Type.valueOf(typeValue);
}
SSLHostConfigCertificate certificate = new SSLHostConfigCertificate(sslHostConfig, type);
digester.push(certificate);
}
use of org.apache.tomcat.util.net.SSLHostConfig in project spring-boot by spring-projects.
the class TomcatServletWebServerFactory method configureSsl.
/**
* Configure Tomcat's {@link AbstractHttp11JsseProtocol} for SSL.
* @param protocol the protocol
* @param ssl the ssl details
*/
protected void configureSsl(AbstractHttp11JsseProtocol<?> protocol, Ssl ssl) {
protocol.setSSLEnabled(true);
protocol.setSslProtocol(ssl.getProtocol());
configureSslClientAuth(protocol, ssl);
protocol.setKeystorePass(ssl.getKeyStorePassword());
protocol.setKeyPass(ssl.getKeyPassword());
protocol.setKeyAlias(ssl.getKeyAlias());
String ciphers = StringUtils.arrayToCommaDelimitedString(ssl.getCiphers());
protocol.setCiphers(StringUtils.hasText(ciphers) ? ciphers : null);
if (ssl.getEnabledProtocols() != null) {
try {
for (SSLHostConfig sslHostConfig : protocol.findSslHostConfigs()) {
sslHostConfig.setProtocols(StringUtils.arrayToCommaDelimitedString(ssl.getEnabledProtocols()));
}
} catch (NoSuchMethodError ex) {
// Tomcat 8.0.x or earlier
Assert.isTrue(protocol.setProperty("sslEnabledProtocols", StringUtils.arrayToCommaDelimitedString(ssl.getEnabledProtocols())), "Failed to set sslEnabledProtocols");
}
}
if (getSslStoreProvider() != null) {
TomcatURLStreamHandlerFactory instance = TomcatURLStreamHandlerFactory.getInstance();
instance.addUserFactory(new SslStoreProviderUrlStreamHandlerFactory(getSslStoreProvider()));
protocol.setKeystoreFile(SslStoreProviderUrlStreamHandlerFactory.KEY_STORE_URL);
protocol.setTruststoreFile(SslStoreProviderUrlStreamHandlerFactory.TRUST_STORE_URL);
} else {
configureSslKeyStore(protocol, ssl);
configureSslTrustStore(protocol, ssl);
}
}
Aggregations