本文整理汇总了Java中org.apache.directory.server.ldap.LdapServer.setKeystoreFile方法的典型用法代码示例。如果您正苦于以下问题:Java LdapServer.setKeystoreFile方法的具体用法?Java LdapServer.setKeystoreFile怎么用?Java LdapServer.setKeystoreFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.directory.server.ldap.LdapServer
的用法示例。
在下文中一共展示了LdapServer.setKeystoreFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: afterPropertiesSet
import org.apache.directory.server.ldap.LdapServer; //导入方法依赖的package包/类
public void afterPropertiesSet() throws Exception {
if (this.enabledLdapOverSsl && this.keyStoreFile == null) {
throw new IllegalArgumentException("When LdapOverSsl is enabled, the keyStoreFile property must be set.");
}
if (workingDir == null) {
String apacheWorkDir = System.getProperty("apacheDSWorkDir");
if (apacheWorkDir == null) {
apacheWorkDir = createTempDirectory("apacheds-spring-security-");
}
setWorkingDirectory(new File(apacheWorkDir));
}
server = new LdapServer();
// AbstractLdapIntegrationTests assume IPv4, so we specify the same here
TcpTransport transport = new TcpTransport(port);
if (enabledLdapOverSsl) {
transport.setEnableSSL(true);
server.setKeystoreFile(this.keyStoreFile.getAbsolutePath());
server.setCertificatePassword(this.keyStorePassword);
}
server.setTransports(transport);
server.setDirectoryService(service);
start();
}
示例2: addTcpServer
import org.apache.directory.server.ldap.LdapServer; //导入方法依赖的package包/类
/**
* Adds a TCP server to the directory service.
*
* Note: The TCP server is not started until start() is called on this Builder.
*
* @param serviceName - The name of this server.
* @param hostName - The host name to listen on.
* @param port - The port to listen on.
* @return This Builder for subsequent changes.
*/
public Builder addTcpServer(final String serviceName, final String hostName, final int port, final String keyStore, final String keyStorePassword) throws URISyntaxException {
assertNotStarted();
if (directoryService == null) {
throw new IllegalStateException("The Directory service has not been created.");
}
LdapServer server = new LdapServer();
server.setServiceName(serviceName);
Transport ldaps = new TcpTransport( hostName, port, 3, 5 );
ldaps.enableSSL(true);
server.addTransports(ldaps);
server.setKeystoreFile(getClass().getResource(keyStore).getFile());
server.setCertificatePassword(keyStorePassword);
server.setDirectoryService(directoryService);
servers.add(server);
return this;
}