本文整理了Java中com.unboundid.ldap.sdk.DN.<init>()
方法的一些代码示例,展示了DN.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DN.<init>()
方法的具体详情如下:
包路径:com.unboundid.ldap.sdk.DN
类名称:DN
方法名:<init>
[英]Creates a new DN below the provided parent DN with the given RDN.
[中]
代码示例来源:origin: kiegroup/jbpm
@Before
public void startDirectoryServer() throws LDAPException {
InMemoryListenerConfig listenerConfig = InMemoryListenerConfig.createLDAPConfig("default", PORT);
InMemoryDirectoryServerConfig serverConfig = new InMemoryDirectoryServerConfig(new DN(BASE_DN));
serverConfig.setListenerConfigs(listenerConfig);
serverConfig.addAdditionalBindCredentials(USER_DN, PASSWORD);
serverConfig.setSchema(null);
server = new InMemoryDirectoryServer(serverConfig);
server.importFromLDIF(false, "src/test/resources/ldap-config.ldif");
server.startListening();
}
代码示例来源:origin: spring-projects/spring-security
@Override
public void start() {
if (isRunning()) {
return;
}
try {
InMemoryDirectoryServerConfig config = new InMemoryDirectoryServerConfig(this.defaultPartitionSuffix);
config.addAdditionalBindCredentials("uid=admin,ou=system", "secret");
config.setListenerConfigs(InMemoryListenerConfig.createLDAPConfig("LDAP", this.port));
config.setEnforceSingleStructuralObjectClass(false);
config.setEnforceAttributeSyntaxCompliance(true);
DN dn = new DN(this.defaultPartitionSuffix);
Entry entry = new Entry(dn);
entry.addAttribute("objectClass", "top", "domain", "extensibleObject");
entry.addAttribute("dc", dn.getRDN().getAttributeValues()[0]);
InMemoryDirectoryServer directoryServer = new InMemoryDirectoryServer(config);
directoryServer.add(entry);
importLdif(directoryServer);
directoryServer.startListening();
this.port = directoryServer.getListenPort();
this.directoryServer = directoryServer;
this.running = true;
} catch (LDAPException ex) {
throw new RuntimeException("Server startup failed", ex);
}
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-minimal-edition
/**
* Retrieves the parsed DN for this entry.
*
* @return The parsed DN for this entry.
*
* @throws LDAPException If the DN string cannot be parsed as a valid DN.
*/
public DN getParsedDN()
throws LDAPException
{
return new DN(dn);
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
/**
* Retrieves the parsed DN for this entry.
*
* @return The parsed DN for this entry.
*
* @throws LDAPException If the DN string cannot be parsed as a valid DN.
*/
public DN getParsedDN()
throws LDAPException
{
return new DN(dn);
}
代码示例来源:origin: io.apiman/apiman-gateway-engine-core
public DefaultLdapDn(String dn) throws LDAPException {
this.dn = new DN(dn);
}
代码示例来源:origin: apiman/apiman
public DefaultLdapDn(String dn) throws LDAPException {
this.dn = new DN(dn);
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
/**
* Retrieves the parsed DN for this entry.
*
* @return The parsed DN for this entry.
*
* @throws LDAPException If the DN string cannot be parsed as a valid DN.
*/
public final DN getParsedDN()
throws LDAPException
{
if (parsedDN == null)
{
parsedDN = new DN(dn, schema);
}
return parsedDN;
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-minimal-edition
/**
* Retrieves the parsed DN for this LDIF change record.
*
* @return The DN for this LDIF change record.
*
* @throws LDAPException If a problem occurs while trying to parse the DN.
*/
public final DN getParsedDN()
throws LDAPException
{
if (parsedDN == null)
{
parsedDN = new DN(dn);
}
return parsedDN;
}
代码示例来源:origin: com.nimbusds/dn-resovler
@Override
public DN resolve(final String attribute)
throws DNResolveException {
if (attribute == null || attribute.isEmpty())
throw new IllegalArgumentException("Bad attribute value: must not be null or empty string");
final String dnString = template.replaceAll("%u", attribute);
try {
return new DN(dnString);
} catch (LDAPException e) {
throw new DNResolveException("The syntax of the resolved DN is invalid");
}
}
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
/**
* Retrieves a read-only representation the entry with the specified DN, if
* it exists.
*
* @param dn The DN of the entry to retrieve.
*
* @return The requested entry, or {@code null} if no entry exists with the
* given DN.
*
* @throws LDAPException If the provided DN is malformed.
*/
public ReadOnlyEntry getEntry(final String dn)
throws LDAPException
{
return getEntry(new DN(dn, schemaRef.get()));
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-minimal-edition
/**
* Retrieves the parent DN for this entry.
*
* @return The parent DN for this entry, or {@code null} if there is no
* parent.
*
* @throws LDAPException If the DN string cannot be parsed as a valid DN.
*/
public final DN getParentDN()
throws LDAPException
{
if (parsedDN == null)
{
parsedDN = new DN(dn, schema);
}
return parsedDN.getParent();
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
/**
* Retrieves the set of RDNs that comprise the DN with the provided string
* representation.
*
* @param s The string representation of the DN for which to retrieve the
* RDNs. It must not be {@code null}.
*
* @return The set of RDNs that comprise the DN with the provided string
* representation.
*
* @throws LDAPException If the provided string cannot be parsed as a DN.
*/
public static RDN[] getRDNs(final String s)
throws LDAPException
{
return new DN(s).getRDNs();
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
/**
* Retrieves the set of string representations of the RDNs that comprise this
* DN.
*
* @param s The string representation of the DN for which to retrieve the
* RDN strings. It must not be {@code null}.
*
* @return The set of string representations of the RDNs that comprise this
* DN.
*
* @throws LDAPException If the provided string cannot be parsed as a DN.
*/
public static String[] getRDNStrings(final String s)
throws LDAPException
{
return new DN(s).getRDNStrings();
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
/**
* Retrieves the parent DN for this entry.
*
* @return The parent DN for this entry, or {@code null} if there is no
* parent.
*
* @throws LDAPException If the DN string cannot be parsed as a valid DN.
*/
public final DN getParentDN()
throws LDAPException
{
if (parsedDN == null)
{
parsedDN = new DN(dn, schema);
}
return parsedDN.getParent();
}
代码示例来源:origin: com.nimbusds/infinispan-ldap-cache-store
@Override
public boolean delete(final Object key) {
// The CacheWriter should remove from the external storage the entry identified by the specified key.
// Note that keys will be in the cache's native format, which means that if the cache is being used by a remoting protocol
// such as HotRod or REST and compatibility mode has not been enabled, then they will be encoded in a byte[].
Loggers.LDAP_LOG.trace("[IL0252] LDAP store: Deleting {} entry with key {}", getCacheName(), key);
DN dn = new DN(ldapEntryTransformer.resolveRDN(resolveKey(key)), config.ldapDirectory.baseDN);
return ldapConnector.deleteEntry(dn);
}
代码示例来源:origin: com.nimbusds/infinispan-cachestore-ldap
@Override
public boolean delete(final Object key) {
// The CacheWriter should remove from the external storage the entry identified by the specified key.
// Note that keys will be in the cache's native format, which means that if the cache is being used by a remoting protocol
// such as HotRod or REST and compatibility mode has not been enabled, then they will be encoded in a byte[].
Loggers.LDAP_LOG.trace("[IL0252] LDAP store: Deleting {} entry with key {}", getCacheName(), key);
DN dn = new DN(ldapEntryTransformer.resolveRDN(resolveKey(key)), config.ldapDirectory.baseDN);
return ldapConnector.deleteEntry(dn);
}
代码示例来源:origin: com.nimbusds/infinispan-ldap-cache-store
@Override
public boolean contains(final Object key) {
// This method will be invoked by the PersistenceManager to determine if the loader contains the specified key.
// The implementation should be as fast as possible, e.g. it should strive to transfer the least amount of data possible
// from the external storage to perform the check. Also, if possible, make sure the field is indexed on the external storage
// so that its existence can be determined as quickly as possible.
//
// Note that keys will be in the cache's native format, which means that if the cache is being used by a remoting protocol
// such as HotRod or REST and compatibility mode has not been enabled, then they will be encoded in a byte[].
Loggers.LDAP_LOG.trace("[IL0250] LDAP store: Checking {} cache key {}", getCacheName(), key);
DN dn = new DN(ldapEntryTransformer.resolveRDN(resolveKey(key)), config.ldapDirectory.baseDN);
return ldapConnector.entryExists(dn);
}
代码示例来源:origin: com.nimbusds/infinispan-cachestore-ldap
@Override
public boolean contains(final Object key) {
// This method will be invoked by the PersistenceManager to determine if the loader contains the specified key.
// The implementation should be as fast as possible, e.g. it should strive to transfer the least amount of data possible
// from the external storage to perform the check. Also, if possible, make sure the field is indexed on the external storage
// so that its existence can be determined as quickly as possible.
//
// Note that keys will be in the cache's native format, which means that if the cache is being used by a remoting protocol
// such as HotRod or REST and compatibility mode has not been enabled, then they will be encoded in a byte[].
Loggers.LDAP_LOG.trace("[IL0250] LDAP store: Checking {} cache key {}", getCacheName(), key);
DN dn = new DN(ldapEntryTransformer.resolveRDN(resolveKey(key)), config.ldapDirectory.baseDN);
return ldapConnector.entryExists(dn);
}
代码示例来源:origin: bozaro/git-as-svn
private EmbeddedDirectoryServer(@NotNull String dn, @NotNull URL ldifStream) throws Exception {
baseDn = new DN(dn);
final InMemoryDirectoryServerConfig config = new InMemoryDirectoryServerConfig(dn);
server = new InMemoryDirectoryServer(config);
try (InputStream in = ldifStream.openStream()) {
server.importFromLDIF(false, new LDIFReader(in));
}
server.startListening();
}
代码示例来源:origin: org.springframework.ldap/spring-ldap-test
public static EmbeddedLdapServer newEmbeddedServer(String defaultPartitionName,
String defaultPartitionSuffix, int port) throws Exception {
InMemoryDirectoryServerConfig config = new InMemoryDirectoryServerConfig(
defaultPartitionSuffix);
config.addAdditionalBindCredentials("uid=admin,ou=system", "secret");
config.setListenerConfigs(InMemoryListenerConfig.createLDAPConfig("LDAP", port));
config.setEnforceSingleStructuralObjectClass(false);
config.setEnforceAttributeSyntaxCompliance(true);
Entry entry = new Entry(new DN(defaultPartitionSuffix));
entry.addAttribute("objectClass", "top", "domain", "extensibleObject");
entry.addAttribute("dc", defaultPartitionName);
InMemoryDirectoryServer directoryServer = new InMemoryDirectoryServer(config);
directoryServer.add(entry);
directoryServer.startListening();
return new EmbeddedLdapServer(directoryServer);
}
内容来源于网络,如有侵权,请联系作者删除!