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


Java TcpTransport.setEnableSSL方法代码示例

本文整理汇总了Java中org.apache.directory.server.protocol.shared.transport.TcpTransport.setEnableSSL方法的典型用法代码示例。如果您正苦于以下问题:Java TcpTransport.setEnableSSL方法的具体用法?Java TcpTransport.setEnableSSL怎么用?Java TcpTransport.setEnableSSL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.directory.server.protocol.shared.transport.TcpTransport的用法示例。


在下文中一共展示了TcpTransport.setEnableSSL方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: afterPropertiesSet

import org.apache.directory.server.protocol.shared.transport.TcpTransport; //导入方法依赖的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();
	}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dataflow,代码行数:32,代码来源:ApacheDSContainerWithSecurity.java

示例2: LdapStandaloneServer

import org.apache.directory.server.protocol.shared.transport.TcpTransport; //导入方法依赖的package包/类
/**
 * Create a single LDAP server.
 *
 * @throws Exception
 */
public LdapStandaloneServer() throws Exception {
    long startTime = System.currentTimeMillis();

    InMemoryDirectoryServiceFactory dsFactory = new InMemoryDirectoryServiceFactory();
    dsFactory.init("ds");

    directoryService = dsFactory.getDirectoryService();
    System.out.println("Directory service started in " + (System.currentTimeMillis() - startTime) + "ms");
    directoryService.setAllowAnonymousAccess(true);
    importLdif("src/dev/resources/ldap/microsoft.ldif",
            "src/dev/resources/ldap/users.ldif");

    ldapServer = new org.apache.directory.server.ldap.LdapServer();
    TcpTransport tcp = new TcpTransport("0.0.0.0", 10389);
    TcpTransport ldapsTcp = new TcpTransport("0.0.0.0", 10636);
    ldapsTcp.setEnableSSL(true);
    ldapsTcp.setEnabledProtocols(Arrays.asList("TLSv1.2"));
    ldapServer.setKeystoreFile("src/dev/resources/bouncr.jks");
    ldapServer.setCertificatePassword("password");
    ldapServer.setTransports(tcp, ldapsTcp);
    ldapServer.setDirectoryService(directoryService);
    ldapServer.start();

    System.out.println("You can connect to the server now");
    final String host = "127.0.0.1";
    System.out.println("URL:      ldap://" + formatPossibleIpv6(host) + ":" + 10389);
    System.out.println("User DN:  uid=admin,ou=system");
    System.out.println("Password: secret");
    System.out.println("LDAP server started in " + (System.currentTimeMillis() - startTime) + "ms");
}
 
开发者ID:kawasima,项目名称:bouncr,代码行数:36,代码来源:LdapStandaloneServer.java

示例3: LdapServer

import org.apache.directory.server.protocol.shared.transport.TcpTransport; //导入方法依赖的package包/类
/**
 * Create a single LDAP server.
 *
 * @param cliArguments
 *
 * @throws Exception
 */
public LdapServer(CLIArguments cliArguments) throws Exception {
    long startTime = System.currentTimeMillis();

    InMemoryDirectoryServiceFactory dsFactory = new InMemoryDirectoryServiceFactory();
    dsFactory.init("ds");

    directoryService = dsFactory.getDirectoryService();
    System.out.println("Directory service started in " + (System.currentTimeMillis() - startTime) + "ms");
    directoryService.setAllowAnonymousAccess(cliArguments.isAllowAnonymous());
    importLdif(cliArguments.getLdifFiles());

    ldapServer = new org.apache.directory.server.ldap.LdapServer();
    TcpTransport tcp = new TcpTransport(cliArguments.getBindAddress(), cliArguments.getPort());
    if (cliArguments.getSslPort() != null) {
        TcpTransport ldapsTcp = new TcpTransport(cliArguments.getBindAddress(), cliArguments.getSslPort());
        ldapsTcp.setEnableSSL(true);
        ldapsTcp.setEnabledProtocols(cliArguments.getSslEnabledProtocols());
        ldapsTcp.setEnabledCiphers(cliArguments.getSslCipherSuite());
        ldapsTcp.setNeedClientAuth(cliArguments.isSslNeedClientAuth());
        ldapsTcp.setWantClientAuth(cliArguments.isSslWantClientAuth());

        ldapServer.setKeystoreFile(cliArguments.getSslKeystoreFile());
        ldapServer.setCertificatePassword(cliArguments.getSslKeystorePassword());
        ldapServer.setTransports(tcp, ldapsTcp);
    } else {
        ldapServer.setTransports(tcp);
    }
    ldapServer.setDirectoryService(directoryService);

    ldapServer.start();

    System.out.println("You can connect to the server now");
    final String host;
    if (CLIArguments.DEFAULT_ADDR.equals(cliArguments.getBindAddress())) {
        host = "127.0.0.1";
    } else {
        host = cliArguments.getBindAddress();
    }
    System.out.println("URL:      ldap://" + formatPossibleIpv6(host) + ":" + cliArguments.getPort());
    if (cliArguments.getSslPort() != null) {
        System.out.println("          ldaps://" + formatPossibleIpv6(host) + ":" + cliArguments.getSslPort());
    }
    System.out.println("User DN:  uid=admin,ou=system");
    System.out.println("Password: secret");
    System.out.println("LDAP server started in " + (System.currentTimeMillis() - startTime) + "ms");
}
 
开发者ID:kwart,项目名称:ldap-server,代码行数:54,代码来源:LdapServer.java


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