use of org.apache.servicecomb.foundation.ssl.SSLOption in project java-chassis by ServiceComb.
the class RBACBootStrapService method createSSLProperties.
private SSLProperties createSSLProperties(Environment environment, String tag) {
SSLProperties sslProperties = new SSLProperties();
SSLOption option = new SSLOption();
option.setEngine(getStringProperty(environment, DEFAULT_OPTION.getEngine(), "ssl." + tag + ".engine", "ssl.engine"));
option.setProtocols(getStringProperty(environment, DEFAULT_OPTION.getProtocols(), "ssl." + tag + ".protocols", "ssl.protocols"));
option.setCiphers(getStringProperty(environment, DEFAULT_OPTION.getCiphers(), "ssl." + tag + ".ciphers", "ssl.ciphers"));
option.setAuthPeer(getBooleanProperty(environment, DEFAULT_OPTION.isAuthPeer(), "ssl." + tag + ".authPeer", "ssl.authPeer"));
option.setCheckCNHost(getBooleanProperty(environment, DEFAULT_OPTION.isCheckCNHost(), "ssl." + tag + ".checkCN.host", "ssl.checkCN.host"));
option.setCheckCNWhite(getBooleanProperty(environment, DEFAULT_OPTION.isCheckCNWhite(), "ssl." + tag + ".checkCN.white", "ssl.checkCN.white"));
option.setCheckCNWhiteFile(getStringProperty(environment, DEFAULT_OPTION.getCiphers(), "ssl." + tag + ".checkCN.white.file", "ssl.checkCN.white.file"));
option.setAllowRenegociate(getBooleanProperty(environment, DEFAULT_OPTION.isAllowRenegociate(), "ssl." + tag + ".allowRenegociate", "ssl.allowRenegociate"));
option.setStorePath(getStringProperty(environment, DEFAULT_OPTION.getStorePath(), "ssl." + tag + ".storePath", "ssl.storePath"));
option.setClientAuth(getStringProperty(environment, DEFAULT_OPTION.getClientAuth(), "ssl." + tag + ".clientAuth", "ssl.clientAuth"));
option.setTrustStore(getStringProperty(environment, DEFAULT_OPTION.getTrustStore(), "ssl." + tag + ".trustStore", "ssl.trustStore"));
option.setTrustStoreType(getStringProperty(environment, DEFAULT_OPTION.getTrustStoreType(), "ssl." + tag + ".trustStoreType", "ssl.trustStoreType"));
option.setTrustStoreValue(getStringProperty(environment, DEFAULT_OPTION.getTrustStoreValue(), "ssl." + tag + ".trustStoreValue", "ssl.trustStoreValue"));
option.setKeyStore(getStringProperty(environment, DEFAULT_OPTION.getKeyStore(), "ssl." + tag + ".keyStore", "ssl.keyStore"));
option.setKeyStoreType(getStringProperty(environment, DEFAULT_OPTION.getKeyStoreType(), "ssl." + tag + ".keyStoreType", "ssl.keyStoreType"));
option.setKeyStoreValue(getStringProperty(environment, DEFAULT_OPTION.getKeyStoreValue(), "ssl." + tag + ".keyStoreValue", "ssl.keyStoreValue"));
option.setCrl(getStringProperty(environment, DEFAULT_OPTION.getCrl(), "ssl." + tag + ".crl", "ssl.crl"));
option.setSslCustomClass(getStringProperty(environment, null, "ssl." + tag + ".sslCustomClass", "ssl.sslCustomClass"));
sslProperties.setSslOption(option);
sslProperties.setSslCustom(SSLCustom.createSSLCustom(option.getSslCustomClass()));
return sslProperties;
}
use of org.apache.servicecomb.foundation.ssl.SSLOption in project java-chassis by ServiceComb.
the class HighwayClient method createTcpClientConfig.
private TcpClientConfig createTcpClientConfig() {
TcpClientConfig tcpClientConfig = new TcpClientConfig();
// global request timeout to be login timeout
tcpClientConfig.setMsLoginTimeout(DynamicPropertyFactory.getInstance().getLongProperty("servicecomb.request.timeout", TcpClientConfig.DEFAULT_LOGIN_TIMEOUT).get());
SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(SSL_KEY, null);
SSLOption sslOption;
if (factory == null) {
sslOption = SSLOption.buildFromYaml(SSL_KEY);
} else {
sslOption = factory.createSSLOption();
}
SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass());
VertxTLSBuilder.buildClientOptionsBase(sslOption, sslCustom, tcpClientConfig);
return tcpClientConfig;
}
use of org.apache.servicecomb.foundation.ssl.SSLOption in project incubator-servicecomb-java-chassis by apache.
the class TestVertxTLSBuilder method testbuildHttpClientOptions.
@Test
public void testbuildHttpClientOptions() {
SSLOption option = SSLOption.buildFromYaml("rest.consumer");
SSLCustom custom = SSLCustom.createSSLCustom(option.getSslCustomClass());
HttpClientOptions serverOptions = new HttpClientOptions();
VertxTLSBuilder.buildHttpClientOptions(option, custom, serverOptions);
Assert.assertEquals(serverOptions.getEnabledSecureTransportProtocols().toArray().length, 1);
Assert.assertEquals(serverOptions.isTrustAll(), true);
}
use of org.apache.servicecomb.foundation.ssl.SSLOption in project incubator-servicecomb-java-chassis by apache.
the class TestVertxTLSBuilder method testbuildClientOptionsBase.
@Test
public void testbuildClientOptionsBase() {
SSLOption option = SSLOption.buildFromYaml("rest.consumer");
SSLCustom custom = SSLCustom.createSSLCustom(option.getSslCustomClass());
HttpClientOptions serverOptions = new HttpClientOptions();
VertxTLSBuilder.buildClientOptionsBase(option, custom, serverOptions);
Assert.assertEquals(serverOptions.getEnabledSecureTransportProtocols().toArray().length, 1);
Assert.assertEquals(serverOptions.isTrustAll(), true);
}
use of org.apache.servicecomb.foundation.ssl.SSLOption in project incubator-servicecomb-java-chassis by apache.
the class TestVertxTLSBuilder method testbuildClientOptionsBaseFileNull.
@Test
public void testbuildClientOptionsBaseFileNull() {
SSLOption option = SSLOption.buildFromYaml("rest.consumer");
option.setKeyStore(null);
option.setTrustStore(null);
option.setCrl(null);
SSLCustom custom = SSLCustom.createSSLCustom(option.getSslCustomClass());
HttpClientOptions serverOptions = new HttpClientOptions();
VertxTLSBuilder.buildClientOptionsBase(option, custom, serverOptions);
Assert.assertEquals(serverOptions.getEnabledSecureTransportProtocols().toArray().length, 1);
Assert.assertEquals(serverOptions.isTrustAll(), true);
}
Aggregations