本文整理汇总了Java中org.apache.tomcat.util.net.SSLHostConfigCertificate类的典型用法代码示例。如果您正苦于以下问题:Java SSLHostConfigCertificate类的具体用法?Java SSLHostConfigCertificate怎么用?Java SSLHostConfigCertificate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SSLHostConfigCertificate类属于org.apache.tomcat.util.net包,在下文中一共展示了SSLHostConfigCertificate类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeConnector
import org.apache.tomcat.util.net.SSLHostConfigCertificate; //导入依赖的package包/类
private Connector makeConnector() {
Connector connector = new Connector(Http11Nio2Protocol.class.getName());
if (keystoreFile == null) {
// HTTP connector
connector.setPort(port);
connector.setSecure(false);
connector.setScheme("http");
} else {
// HTTPS connector
connector.setPort(securePort);
connector.setSecure(true);
connector.setScheme("https");
connector.setAttribute("SSLEnabled", "true");
SSLHostConfig sslHostConfig = new SSLHostConfig();
SSLHostConfigCertificate cert =
new SSLHostConfigCertificate(sslHostConfig, SSLHostConfigCertificate.Type.RSA);
cert.setCertificateKeystoreFile(keystoreFile.toAbsolutePath().toString());
cert.setCertificateKeystorePassword(keystorePassword);
cert.setCertificateKeyAlias(keyAlias);
sslHostConfig.addCertificate(cert);
connector.addSslHostConfig(sslHostConfig);
}
connector.addUpgradeProtocol(new Http2Protocol());
// Keep quiet about the server type
connector.setXpoweredBy(false);
// Basic tuning params:
connector.setAttribute("maxThreads", 400);
connector.setAttribute("acceptCount", 50);
//connector.setAttribute("connectionTimeout", 2000);
connector.setAttribute("maxKeepAliveRequests", 100);
// Avoid running out of ephemeral ports under heavy load?
connector.setAttribute("socket.soReuseAddress", true);
connector.setMaxPostSize(0);
connector.setAttribute("disableUploadTimeout", false);
// Allow long URLs
connector.setAttribute("maxHttpHeaderSize", 65536);
// Enable response compression
connector.setAttribute("compression", "on");
// Defaults are text/html,text/xml,text/plain,text/css
connector.setAttribute("compressableMimeType", "text/html,text/xml,text/plain,text/css,text/csv,application/json");
return connector;
}
示例2: toSslHostConfigInfo
import org.apache.tomcat.util.net.SSLHostConfigCertificate; //导入依赖的package包/类
/**
* To SslHostConfig info.
*
* @param sslHostConfig the SslHostConfig
* @return the SslHostConfig info
* @throws IllegalAccessException the illegal access exception
* @throws InvocationTargetException the invocation target exception
*/
private SslHostConfigInfo toSslHostConfigInfo(SSLHostConfig sslHostConfig)
throws IllegalAccessException, InvocationTargetException {
SslHostConfigInfo sslHostConfigInfo = new SslHostConfigInfo();
BeanUtils.copyProperties(sslHostConfigInfo, sslHostConfig);
Set<SSLHostConfigCertificate> certificates = sslHostConfig.getCertificates();
List<CertificateInfo> certificateInfos = new ArrayList<>(certificates.size());
sslHostConfigInfo.setCertificateInfos(certificateInfos);
for (SSLHostConfigCertificate sslHostConfigCertificate : certificates) {
certificateInfos.add(toCertificateInfo(sslHostConfigCertificate));
}
return sslHostConfigInfo;
}
示例3: BlacklistingJSSESocketFactory
import org.apache.tomcat.util.net.SSLHostConfigCertificate; //导入依赖的package包/类
public BlacklistingJSSESocketFactory(SSLHostConfigCertificate certificate) {
super(certificate);
String blacklistFile = Optional.ofNullable(certificate.getSSLHostConfig().getCertificateRevocationListFile())
.filter(file -> file.startsWith(BLACKLIST_PREFIX))
.map(file -> file.substring(BLACKLIST_PREFIX.length()))
.orElse(null);
if (blacklistFile != null) {
certificate.getSSLHostConfig().setCertificateRevocationListFile(null);
blacklist = Blacklist.forFile(blacklistFile);
} else {
blacklist = null;
}
}
示例4: decodePasswords
import org.apache.tomcat.util.net.SSLHostConfigCertificate; //导入依赖的package包/类
static SSLHostConfigCertificate decodePasswords(SSLHostConfigCertificate certificate) {
String certificateKeystorePassword = certificate.getCertificateKeystorePassword();
if (certificateKeystorePassword != null) {
certificate.setCertificateKeystorePassword(Encryption.decode(certificateKeystorePassword));
}
String certificateKeyPassword = certificate.getCertificateKeyPassword();
if (certificateKeyPassword != null) {
certificate.setCertificateKeyPassword(Encryption.decode(certificateKeyPassword));
}
return certificate;
}
示例5: keystorePass_should_be_decoded
import org.apache.tomcat.util.net.SSLHostConfigCertificate; //导入依赖的package包/类
@Test
public void keystorePass_should_be_decoded() throws Exception {
// GIVeN
// WHeN
protocol.setKeystorePass(ENCRYPTED_PASSWORD);
// THeN
SSLHostConfigCertificate certificate = getSslHostConfigCertificate(protocol);
assertThat(certificate.getCertificateKeystorePassword()).isEqualTo(CLEAR_PASSWORD);
}
示例6: keyPass_should_be_decoded
import org.apache.tomcat.util.net.SSLHostConfigCertificate; //导入依赖的package包/类
@Test
public void keyPass_should_be_decoded() throws Exception {
// GIVeN
// WHeN
protocol.setKeyPass(ENCRYPTED_PASSWORD);
// THeN
SSLHostConfigCertificate certificate = getSslHostConfigCertificate(protocol);
assertThat(certificate.getCertificateKeyPassword()).isEqualTo(CLEAR_PASSWORD);
}
示例7: getSSLUtil
import org.apache.tomcat.util.net.SSLHostConfigCertificate; //导入依赖的package包/类
@Override
public SSLUtil getSSLUtil(SSLHostConfigCertificate cert) {
return new JSSUtil();
}
示例8: getSSLUtil
import org.apache.tomcat.util.net.SSLHostConfigCertificate; //导入依赖的package包/类
@Override
public SSLUtil getSSLUtil(SSLHostConfigCertificate certificate) {
return new BlacklistingJSSESocketFactory(certificate);
}
示例9: getSSLUtil
import org.apache.tomcat.util.net.SSLHostConfigCertificate; //导入依赖的package包/类
@Override
public SSLUtil getSSLUtil(SSLHostConfigCertificate certificate) {
return super.getSSLUtil(decodePasswords(certificate));
}
示例10: getSslHostConfigCertificate
import org.apache.tomcat.util.net.SSLHostConfigCertificate; //导入依赖的package包/类
private SSLHostConfigCertificate getSslHostConfigCertificate(EncryptedSslHttp11NioProtocol protocol) {
return getSslHostConfig(protocol).getCertificates().iterator().next();
}
示例11: getSslHostConfigCertificate
import org.apache.tomcat.util.net.SSLHostConfigCertificate; //导入依赖的package包/类
private SSLHostConfigCertificate getSslHostConfigCertificate(EncryptedSslHttp11Nio2Protocol protocol) {
return getSslHostConfig(protocol).getCertificates().iterator().next();
}
示例12: toCertificateInfo
import org.apache.tomcat.util.net.SSLHostConfigCertificate; //导入依赖的package包/类
/**
* To certificate info.
*
* @param sslHostConfigCertificate the SslHostConfigCertificate
* @return the certificate info
* @throws IllegalAccessException the illegal access exception
* @throws InvocationTargetException the invocation target exception
*/
private CertificateInfo toCertificateInfo(SSLHostConfigCertificate sslHostConfigCertificate)
throws IllegalAccessException, InvocationTargetException {
CertificateInfo certificateInfo = new CertificateInfo();
BeanUtils.copyProperties(certificateInfo, sslHostConfigCertificate);
return certificateInfo;
}