本文整理汇总了Java中org.apache.directory.server.annotations.CreateTransport类的典型用法代码示例。如果您正苦于以下问题:Java CreateTransport类的具体用法?Java CreateTransport怎么用?Java CreateTransport使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CreateTransport类属于org.apache.directory.server.annotations包,在下文中一共展示了CreateTransport类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.apache.directory.server.annotations.CreateTransport; //导入依赖的package包/类
@BeforeClass
@CreateDS(
name = "WildFlyDS",
factory = org.jboss.as.test.integration.mgmt.access.ldap.InMemoryDirectoryServiceFactory.class,
partitions = @CreatePartition(name = "wildfly", suffix = "dc=wildfly,dc=org"),
allowAnonAccess = true
)
@CreateLdapServer(
transports = @CreateTransport(protocol = "LDAP", address = "localhost", port = 10389),
allowAnonymousAccess = true
)
public static void setUp() throws Exception {
directoryService = DSAnnotationProcessor.getDirectoryService();
SchemaManager schemaManager = directoryService.getSchemaManager();
InputStream ldif = LdapRoleMappingG2UTestCase.class.getResourceAsStream("/" + LdapRoleMappingG2UTestCase.class.getSimpleName() + ".ldif");
for (LdifEntry ldifEntry : new LdifReader(ldif)) {
directoryService.getAdminSession().add(new DefaultEntry(schemaManager, ldifEntry.getEntry()));
}
ldapServer = ServerAnnotationProcessor.getLdapServer(directoryService);
}
示例2: setUp
import org.apache.directory.server.annotations.CreateTransport; //导入依赖的package包/类
@BeforeClass
@CreateDS(
name = "WildFlyDS",
factory = org.jboss.as.test.integration.mgmt.access.ldap.InMemoryDirectoryServiceFactory.class,
partitions = @CreatePartition(name = "wildfly", suffix = "dc=wildfly,dc=org"),
allowAnonAccess = true
)
@CreateLdapServer(
transports = @CreateTransport(protocol = "LDAP", address = "localhost", port = 10389),
allowAnonymousAccess = true
)
public static void setUp() throws Exception {
directoryService = DSAnnotationProcessor.getDirectoryService();
SchemaManager schemaManager = directoryService.getSchemaManager();
InputStream ldif = LdapRoleMappingU2GTestCase.class.getResourceAsStream("/" + LdapRoleMappingU2GTestCase.class.getSimpleName() + ".ldif");
for (LdifEntry ldifEntry : new LdifReader(ldif)) {
directoryService.getAdminSession().add(new DefaultEntry(schemaManager, ldifEntry.getEntry()));
}
ldapServer = ServerAnnotationProcessor.getLdapServer(directoryService);
}
示例3: setUpLdap
import org.apache.directory.server.annotations.CreateTransport; //导入依赖的package包/类
@BeforeClass
@CreateDS(
name = "WildFlyDS",
factory = InMemoryDirectoryServiceFactory.class,
partitions = @CreatePartition(name = "wildfly", suffix = "dc=wildfly,dc=org"),
allowAnonAccess = true
)
@CreateLdapServer(
transports = @CreateTransport(protocol = "LDAP", address = "localhost", port = 10389),
allowAnonymousAccess = true
)
public static void setUpLdap() throws Exception {
directoryService = DSAnnotationProcessor.getDirectoryService();
final SchemaManager schemaManager = directoryService.getSchemaManager();
final InputStream ldif = OutboundLdapConnectionTestCase.class
.getResourceAsStream("/" + OutboundLdapConnectionTestCase.class.getSimpleName() + ".ldif");
for (LdifEntry ldifEntry : new LdifReader(ldif)) {
directoryService.getAdminSession().add(new DefaultEntry(schemaManager, ldifEntry.getEntry()));
}
ldapServer = ServerAnnotationProcessor.getLdapServer(directoryService);
}
示例4: createTransport
import org.apache.directory.server.annotations.CreateTransport; //导入依赖的package包/类
private static Transport createTransport( CreateTransport transportBuilder, int startPort )
{
String protocol = transportBuilder.protocol();
int port = transportBuilder.port();
int nbThreads = transportBuilder.nbThreads();
int backlog = transportBuilder.backlog();
String address = transportBuilder.address();
if ( port == -1 )
{
port = AvailablePortFinder.getNextAvailable( startPort );
startPort = port + 1;
}
if ( protocol.equalsIgnoreCase( "TCP" ) )
{
Transport tcp = new TcpTransport( address, port, nbThreads, backlog );
return tcp;
}
else if ( protocol.equalsIgnoreCase( "UDP" ) )
{
UdpTransport udp = new UdpTransport( address, port );
return udp;
}
else
{
throw new IllegalArgumentException( I18n.err( I18n.ERR_689, protocol ) );
}
}
示例5: fixApacheDSTransportAddress
import org.apache.directory.server.annotations.CreateTransport; //导入依赖的package包/类
/**
* Fixes/replaces LDAP bind address in the CreateTransport annotation of ApacheDS.
*
* @param createLdapServer
* @param address
*/
public static void fixApacheDSTransportAddress(ManagedCreateLdapServer createLdapServer, String address) {
final CreateTransport[] createTransports = createLdapServer.transports();
for (int i = 0; i < createTransports.length; i++) {
final ManagedCreateTransport mgCreateTransport = new ManagedCreateTransport(createTransports[i]);
// localhost is a default used in original CreateTransport annotation. We use it as a fallback.
mgCreateTransport.setAddress(address != null ? address : "localhost");
createTransports[i] = mgCreateTransport;
}
}
示例6: ManagedCreateTransport
import org.apache.directory.server.annotations.CreateTransport; //导入依赖的package包/类
/**
* Create a new ManagedCreateTransport.
*
* @param createLdapServer
*/
public ManagedCreateTransport(final CreateTransport original) {
protocol = original.protocol();
type = original.type();
port = original.port();
address = original.address();
backlog = original.backlog();
ssl = original.ssl();
nbThreads = original.nbThreads();
}
示例7: start
import org.apache.directory.server.annotations.CreateTransport; //导入依赖的package包/类
@CreateDS(name = "ExampleComDS", allowAnonAccess = true, partitions = { @CreatePartition(name = "examplecom", suffix = "o=TEST", contextEntry = @ContextEntry(entryLdif = "dn: o=TEST\n"
+ "dc: TEST\n" + "objectClass: top\n" + "objectClass: domain\n\n"), indexes = { @CreateIndex(attribute = "objectClass"),
@CreateIndex(attribute = "dc"), @CreateIndex(attribute = "ou") }) }, additionalInterceptors = { KeyDerivationInterceptor.class })
@CreateLdapServer(allowAnonymousAccess = true, transports = {
@CreateTransport(protocol = "LDAP", address = "localhost", port = ldapPort),
@CreateTransport(protocol = "LDAPS", address = "localhost", port = ldapsPort) },
saslHost = "localhost", saslPrincipal = "ldap/[email protected]", saslMechanisms = {
@SaslMechanism(name = SupportedSaslMechanisms.PLAIN, implClass = PlainMechanismHandler.class),
@SaslMechanism(name = SupportedSaslMechanisms.CRAM_MD5, implClass = CramMd5MechanismHandler.class),
@SaslMechanism(name = SupportedSaslMechanisms.DIGEST_MD5, implClass = DigestMd5MechanismHandler.class),
@SaslMechanism(name = SupportedSaslMechanisms.GSSAPI, implClass = GssapiMechanismHandler.class),
@SaslMechanism(name = SupportedSaslMechanisms.NTLM, implClass = NtlmMechanismHandler.class),
@SaslMechanism(name = SupportedSaslMechanisms.GSS_SPNEGO, implClass = NtlmMechanismHandler.class) }, extendedOpHandlers = { StartTlsHandler.class }
)
@CreateKdcServer(primaryRealm = "example.com", kdcPrincipal = "krbtgt/[email protected]", searchBaseDn = "o=TEST",
//maxTicketLifetime = 1000,
//maxRenewableLifetime = 2000,
transports = { @CreateTransport(protocol = "TCP", port = kdcPort), @CreateTransport(protocol = "UDP", port = kdcPort) })
public void start() throws Exception {
directoryService = DSAnnotationProcessor.getDirectoryService();
kdcServer = ServerAnnotationProcessor.getKdcServer(directoryService, kdcPort);
kdcServer.getConfig().setPaEncTimestampRequired(false);
schemaManager = directoryService.getSchemaManager();
final CreateLdapServer cl = (CreateLdapServer) AnnotationUtils.getInstance(CreateLdapServer.class);
ldapServer = ServerAnnotationProcessor.instantiateLdapServer(cl, directoryService);
ldapServer.setKeystoreFile(SecurityUtil.getAbsoluteFilePathFromClassPath("ArmorKS.jks").getAbsolutePath());
ldapServer.setCertificatePassword("changeit");
ldapServer.setEnabledCipherSuites(Arrays.asList(SecurityUtil.ENABLED_SSL_CIPHERS));
if (ldapServer.isStarted()) {
throw new IllegalStateException("Service already running");
}
ldapServer.start();
log.debug("LDAP started");
}
示例8: transports
import org.apache.directory.server.annotations.CreateTransport; //导入依赖的package包/类
/**
*
* @return
* @see org.apache.directory.server.annotations.CreateLdapServer#transports()
*/
public CreateTransport[] transports() {
return transports;
}
示例9: setTransports
import org.apache.directory.server.annotations.CreateTransport; //导入依赖的package包/类
/**
* Set the transports.
*
* @param transports The transports to set.
*/
public void setTransports(CreateTransport[] transports) {
this.transports = transports;
}