本文整理汇总了Java中org.apache.coyote.http11.AbstractHttp11JsseProtocol.setKeystoreFile方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractHttp11JsseProtocol.setKeystoreFile方法的具体用法?Java AbstractHttp11JsseProtocol.setKeystoreFile怎么用?Java AbstractHttp11JsseProtocol.setKeystoreFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.coyote.http11.AbstractHttp11JsseProtocol
的用法示例。
在下文中一共展示了AbstractHttp11JsseProtocol.setKeystoreFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: build
import org.apache.coyote.http11.AbstractHttp11JsseProtocol; //导入方法依赖的package包/类
public void build(AbstractHttp11JsseProtocol<?> protocol,SSLProperties sslProperties) {
protocol.setKeystoreFile(sslProperties.getKeyStoreFile()); // contains server keypair
protocol.setKeyPass(sslProperties.getKeyStorePass());
sslProperties.getKeyStoreType().ifPresent(type->protocol.setKeystoreType(type));
sslProperties.getKeyStoreProvider().ifPresent(provider->protocol.setKeystoreProvider(provider));
sslProperties.getTrustStoreFile().ifPresent(file->protocol.setTruststoreFile(file)); // contains client certificate
sslProperties.getTrustStorePass().ifPresent(pass->protocol.setTruststorePass(pass));
sslProperties.getTrustStoreType().ifPresent(type->protocol.setTruststoreType(type));
sslProperties.getTrustStoreProvider().ifPresent(provider->protocol.setTruststoreProvider(provider));
sslProperties.getClientAuth().ifPresent(auth->protocol.setClientAuth(auth));
protocol.setSSLEnabled(true);
sslProperties.getCiphers().ifPresent(ciphers->protocol.setCiphers(ciphers));
sslProperties.getProtocol().ifPresent(pr->protocol.setSslProtocol(pr));
}
示例2: configureSslKeyStore
import org.apache.coyote.http11.AbstractHttp11JsseProtocol; //导入方法依赖的package包/类
private void configureSslKeyStore(AbstractHttp11JsseProtocol<?> protocol, Ssl ssl) {
try {
protocol.setKeystoreFile(ResourceUtils.getURL(ssl.getKeyStore()).toString());
}
catch (FileNotFoundException ex) {
throw new EmbeddedServletContainerException(
"Could not load key store: " + ex.getMessage(), ex);
}
if (ssl.getKeyStoreType() != null) {
protocol.setKeystoreType(ssl.getKeyStoreType());
}
if (ssl.getKeyStoreProvider() != null) {
protocol.setKeystoreProvider(ssl.getKeyStoreProvider());
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:16,代码来源:TomcatEmbeddedServletContainerFactory.java
示例3: configureSsl
import org.apache.coyote.http11.AbstractHttp11JsseProtocol; //导入方法依赖的package包/类
/**
* 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);
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:46,代码来源:TomcatEmbeddedServletContainerFactory.java