本文整理汇总了Java中org.apache.ftpserver.ssl.SslConfigurationFactory.setClientAuthentication方法的典型用法代码示例。如果您正苦于以下问题:Java SslConfigurationFactory.setClientAuthentication方法的具体用法?Java SslConfigurationFactory.setClientAuthentication怎么用?Java SslConfigurationFactory.setClientAuthentication使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ftpserver.ssl.SslConfigurationFactory
的用法示例。
在下文中一共展示了SslConfigurationFactory.setClientAuthentication方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSslConfiguration
import org.apache.ftpserver.ssl.SslConfigurationFactory; //导入方法依赖的package包/类
protected SslConfigurationFactory createSslConfiguration() {
// comment in, if you have trouble with SSL
// System.setProperty("javax.net.debug", "all");
SslConfigurationFactory sslConfigFactory = new SslConfigurationFactory();
sslConfigFactory.setSslProtocol(getAuthValue());
sslConfigFactory.setKeystoreFile(FTPSERVER_KEYSTORE);
sslConfigFactory.setKeystoreType("JKS");
sslConfigFactory.setKeystoreAlgorithm("SunX509");
sslConfigFactory.setKeystorePassword(FTPSERVER_KEYSTORE_PASSWORD);
sslConfigFactory.setKeyPassword(FTPSERVER_KEYSTORE_PASSWORD);
sslConfigFactory.setClientAuthentication(getClientAuth());
if (Boolean.valueOf(getClientAuth())) {
sslConfigFactory.setTruststoreFile(FTPSERVER_KEYSTORE);
sslConfigFactory.setTruststoreType("JKS");
sslConfigFactory.setTruststoreAlgorithm("SunX509");
sslConfigFactory.setTruststorePassword(FTPSERVER_KEYSTORE_PASSWORD);
}
return sslConfigFactory;
}
示例2: configureSSL
import org.apache.ftpserver.ssl.SslConfigurationFactory; //导入方法依赖的package包/类
private ListenerFactory configureSSL() {
ListenerFactory listener = new ListenerFactory();
listener.setServerAddress("127.0.0.1");
listener.setPort(PORT);
SslConfigurationFactory ssl = new SslConfigurationFactory();
ssl.setKeystoreFile(SERVER_SSL_KEY_TRUST_STORE);
ssl.setKeyPassword(SERVER_SSL_KEY_PASSWD);
ssl.setKeystorePassword(SERVER_SSL_STORE_PASSWD);
ssl.setTruststoreFile(SERVER_SSL_KEY_TRUST_STORE);
ssl.setTruststorePassword(SERVER_SSL_STORE_PASSWD);
ssl.setClientAuthentication("NEED");
SslConfiguration sslConfig = ssl.createSslConfiguration();
listener.setSslConfiguration(sslConfig);
listener.setImplicitSsl(true);
DataConnectionConfigurationFactory dataConfigFactory = new DataConnectionConfigurationFactory();
dataConfigFactory.setImplicitSsl(true);
listener.setDataConnectionConfiguration(dataConfigFactory.createDataConnectionConfiguration());
return listener;
}