当前位置: 首页>>代码示例>>Java>>正文


Java AbstractHttp11JsseProtocol.setKeystoreFile方法代码示例

本文整理汇总了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));
      

}
 
开发者ID:aol,项目名称:micro-server,代码行数:20,代码来源:SSLConfigurationBuilder.java

示例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


注:本文中的org.apache.coyote.http11.AbstractHttp11JsseProtocol.setKeystoreFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。