com.unboundid.ldap.sdk.DN.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(10.0k)|赞(0)|评价(0)|浏览(117)

本文整理了Java中com.unboundid.ldap.sdk.DN.<init>()方法的一些代码示例,展示了DN.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DN.<init>()方法的具体详情如下:
包路径:com.unboundid.ldap.sdk.DN
类名称:DN
方法名:<init>

DN.<init>介绍

[英]Creates a new DN below the provided parent DN with the given RDN.
[中]

代码示例

代码示例来源:origin: kiegroup/jbpm

  1. @Before
  2. public void startDirectoryServer() throws LDAPException {
  3. InMemoryListenerConfig listenerConfig = InMemoryListenerConfig.createLDAPConfig("default", PORT);
  4. InMemoryDirectoryServerConfig serverConfig = new InMemoryDirectoryServerConfig(new DN(BASE_DN));
  5. serverConfig.setListenerConfigs(listenerConfig);
  6. serverConfig.addAdditionalBindCredentials(USER_DN, PASSWORD);
  7. serverConfig.setSchema(null);
  8. server = new InMemoryDirectoryServer(serverConfig);
  9. server.importFromLDIF(false, "src/test/resources/ldap-config.ldif");
  10. server.startListening();
  11. }

代码示例来源:origin: spring-projects/spring-security

  1. @Override
  2. public void start() {
  3. if (isRunning()) {
  4. return;
  5. }
  6. try {
  7. InMemoryDirectoryServerConfig config = new InMemoryDirectoryServerConfig(this.defaultPartitionSuffix);
  8. config.addAdditionalBindCredentials("uid=admin,ou=system", "secret");
  9. config.setListenerConfigs(InMemoryListenerConfig.createLDAPConfig("LDAP", this.port));
  10. config.setEnforceSingleStructuralObjectClass(false);
  11. config.setEnforceAttributeSyntaxCompliance(true);
  12. DN dn = new DN(this.defaultPartitionSuffix);
  13. Entry entry = new Entry(dn);
  14. entry.addAttribute("objectClass", "top", "domain", "extensibleObject");
  15. entry.addAttribute("dc", dn.getRDN().getAttributeValues()[0]);
  16. InMemoryDirectoryServer directoryServer = new InMemoryDirectoryServer(config);
  17. directoryServer.add(entry);
  18. importLdif(directoryServer);
  19. directoryServer.startListening();
  20. this.port = directoryServer.getListenPort();
  21. this.directoryServer = directoryServer;
  22. this.running = true;
  23. } catch (LDAPException ex) {
  24. throw new RuntimeException("Server startup failed", ex);
  25. }
  26. }

代码示例来源:origin: com.unboundid/unboundid-ldapsdk-minimal-edition

  1. /**
  2. * Retrieves the parsed DN for this entry.
  3. *
  4. * @return The parsed DN for this entry.
  5. *
  6. * @throws LDAPException If the DN string cannot be parsed as a valid DN.
  7. */
  8. public DN getParsedDN()
  9. throws LDAPException
  10. {
  11. return new DN(dn);
  12. }

代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition

  1. /**
  2. * Retrieves the parsed DN for this entry.
  3. *
  4. * @return The parsed DN for this entry.
  5. *
  6. * @throws LDAPException If the DN string cannot be parsed as a valid DN.
  7. */
  8. public DN getParsedDN()
  9. throws LDAPException
  10. {
  11. return new DN(dn);
  12. }

代码示例来源:origin: io.apiman/apiman-gateway-engine-core

  1. public DefaultLdapDn(String dn) throws LDAPException {
  2. this.dn = new DN(dn);
  3. }

代码示例来源:origin: apiman/apiman

  1. public DefaultLdapDn(String dn) throws LDAPException {
  2. this.dn = new DN(dn);
  3. }

代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition

  1. /**
  2. * Retrieves the parsed DN for this entry.
  3. *
  4. * @return The parsed DN for this entry.
  5. *
  6. * @throws LDAPException If the DN string cannot be parsed as a valid DN.
  7. */
  8. public final DN getParsedDN()
  9. throws LDAPException
  10. {
  11. if (parsedDN == null)
  12. {
  13. parsedDN = new DN(dn, schema);
  14. }
  15. return parsedDN;
  16. }

代码示例来源:origin: com.unboundid/unboundid-ldapsdk-minimal-edition

  1. /**
  2. * Retrieves the parsed DN for this LDIF change record.
  3. *
  4. * @return The DN for this LDIF change record.
  5. *
  6. * @throws LDAPException If a problem occurs while trying to parse the DN.
  7. */
  8. public final DN getParsedDN()
  9. throws LDAPException
  10. {
  11. if (parsedDN == null)
  12. {
  13. parsedDN = new DN(dn);
  14. }
  15. return parsedDN;
  16. }

代码示例来源:origin: com.nimbusds/dn-resovler

  1. @Override
  2. public DN resolve(final String attribute)
  3. throws DNResolveException {
  4. if (attribute == null || attribute.isEmpty())
  5. throw new IllegalArgumentException("Bad attribute value: must not be null or empty string");
  6. final String dnString = template.replaceAll("%u", attribute);
  7. try {
  8. return new DN(dnString);
  9. } catch (LDAPException e) {
  10. throw new DNResolveException("The syntax of the resolved DN is invalid");
  11. }
  12. }
  13. }

代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition

  1. /**
  2. * Retrieves a read-only representation the entry with the specified DN, if
  3. * it exists.
  4. *
  5. * @param dn The DN of the entry to retrieve.
  6. *
  7. * @return The requested entry, or {@code null} if no entry exists with the
  8. * given DN.
  9. *
  10. * @throws LDAPException If the provided DN is malformed.
  11. */
  12. public ReadOnlyEntry getEntry(final String dn)
  13. throws LDAPException
  14. {
  15. return getEntry(new DN(dn, schemaRef.get()));
  16. }

代码示例来源:origin: com.unboundid/unboundid-ldapsdk-minimal-edition

  1. /**
  2. * Retrieves the parent DN for this entry.
  3. *
  4. * @return The parent DN for this entry, or {@code null} if there is no
  5. * parent.
  6. *
  7. * @throws LDAPException If the DN string cannot be parsed as a valid DN.
  8. */
  9. public final DN getParentDN()
  10. throws LDAPException
  11. {
  12. if (parsedDN == null)
  13. {
  14. parsedDN = new DN(dn, schema);
  15. }
  16. return parsedDN.getParent();
  17. }

代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition

  1. /**
  2. * Retrieves the set of RDNs that comprise the DN with the provided string
  3. * representation.
  4. *
  5. * @param s The string representation of the DN for which to retrieve the
  6. * RDNs. It must not be {@code null}.
  7. *
  8. * @return The set of RDNs that comprise the DN with the provided string
  9. * representation.
  10. *
  11. * @throws LDAPException If the provided string cannot be parsed as a DN.
  12. */
  13. public static RDN[] getRDNs(final String s)
  14. throws LDAPException
  15. {
  16. return new DN(s).getRDNs();
  17. }

代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition

  1. /**
  2. * Retrieves the set of string representations of the RDNs that comprise this
  3. * DN.
  4. *
  5. * @param s The string representation of the DN for which to retrieve the
  6. * RDN strings. It must not be {@code null}.
  7. *
  8. * @return The set of string representations of the RDNs that comprise this
  9. * DN.
  10. *
  11. * @throws LDAPException If the provided string cannot be parsed as a DN.
  12. */
  13. public static String[] getRDNStrings(final String s)
  14. throws LDAPException
  15. {
  16. return new DN(s).getRDNStrings();
  17. }

代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition

  1. /**
  2. * Retrieves the parent DN for this entry.
  3. *
  4. * @return The parent DN for this entry, or {@code null} if there is no
  5. * parent.
  6. *
  7. * @throws LDAPException If the DN string cannot be parsed as a valid DN.
  8. */
  9. public final DN getParentDN()
  10. throws LDAPException
  11. {
  12. if (parsedDN == null)
  13. {
  14. parsedDN = new DN(dn, schema);
  15. }
  16. return parsedDN.getParent();
  17. }

代码示例来源:origin: com.nimbusds/infinispan-ldap-cache-store

  1. @Override
  2. public boolean delete(final Object key) {
  3. // The CacheWriter should remove from the external storage the entry identified by the specified key.
  4. // Note that keys will be in the cache's native format, which means that if the cache is being used by a remoting protocol
  5. // such as HotRod or REST and compatibility mode has not been enabled, then they will be encoded in a byte[].
  6. Loggers.LDAP_LOG.trace("[IL0252] LDAP store: Deleting {} entry with key {}", getCacheName(), key);
  7. DN dn = new DN(ldapEntryTransformer.resolveRDN(resolveKey(key)), config.ldapDirectory.baseDN);
  8. return ldapConnector.deleteEntry(dn);
  9. }

代码示例来源:origin: com.nimbusds/infinispan-cachestore-ldap

  1. @Override
  2. public boolean delete(final Object key) {
  3. // The CacheWriter should remove from the external storage the entry identified by the specified key.
  4. // Note that keys will be in the cache's native format, which means that if the cache is being used by a remoting protocol
  5. // such as HotRod or REST and compatibility mode has not been enabled, then they will be encoded in a byte[].
  6. Loggers.LDAP_LOG.trace("[IL0252] LDAP store: Deleting {} entry with key {}", getCacheName(), key);
  7. DN dn = new DN(ldapEntryTransformer.resolveRDN(resolveKey(key)), config.ldapDirectory.baseDN);
  8. return ldapConnector.deleteEntry(dn);
  9. }

代码示例来源:origin: com.nimbusds/infinispan-ldap-cache-store

  1. @Override
  2. public boolean contains(final Object key) {
  3. // This method will be invoked by the PersistenceManager to determine if the loader contains the specified key.
  4. // The implementation should be as fast as possible, e.g. it should strive to transfer the least amount of data possible
  5. // from the external storage to perform the check. Also, if possible, make sure the field is indexed on the external storage
  6. // so that its existence can be determined as quickly as possible.
  7. //
  8. // Note that keys will be in the cache's native format, which means that if the cache is being used by a remoting protocol
  9. // such as HotRod or REST and compatibility mode has not been enabled, then they will be encoded in a byte[].
  10. Loggers.LDAP_LOG.trace("[IL0250] LDAP store: Checking {} cache key {}", getCacheName(), key);
  11. DN dn = new DN(ldapEntryTransformer.resolveRDN(resolveKey(key)), config.ldapDirectory.baseDN);
  12. return ldapConnector.entryExists(dn);
  13. }

代码示例来源:origin: com.nimbusds/infinispan-cachestore-ldap

  1. @Override
  2. public boolean contains(final Object key) {
  3. // This method will be invoked by the PersistenceManager to determine if the loader contains the specified key.
  4. // The implementation should be as fast as possible, e.g. it should strive to transfer the least amount of data possible
  5. // from the external storage to perform the check. Also, if possible, make sure the field is indexed on the external storage
  6. // so that its existence can be determined as quickly as possible.
  7. //
  8. // Note that keys will be in the cache's native format, which means that if the cache is being used by a remoting protocol
  9. // such as HotRod or REST and compatibility mode has not been enabled, then they will be encoded in a byte[].
  10. Loggers.LDAP_LOG.trace("[IL0250] LDAP store: Checking {} cache key {}", getCacheName(), key);
  11. DN dn = new DN(ldapEntryTransformer.resolveRDN(resolveKey(key)), config.ldapDirectory.baseDN);
  12. return ldapConnector.entryExists(dn);
  13. }

代码示例来源:origin: bozaro/git-as-svn

  1. private EmbeddedDirectoryServer(@NotNull String dn, @NotNull URL ldifStream) throws Exception {
  2. baseDn = new DN(dn);
  3. final InMemoryDirectoryServerConfig config = new InMemoryDirectoryServerConfig(dn);
  4. server = new InMemoryDirectoryServer(config);
  5. try (InputStream in = ldifStream.openStream()) {
  6. server.importFromLDIF(false, new LDIFReader(in));
  7. }
  8. server.startListening();
  9. }

代码示例来源:origin: org.springframework.ldap/spring-ldap-test

  1. public static EmbeddedLdapServer newEmbeddedServer(String defaultPartitionName,
  2. String defaultPartitionSuffix, int port) throws Exception {
  3. InMemoryDirectoryServerConfig config = new InMemoryDirectoryServerConfig(
  4. defaultPartitionSuffix);
  5. config.addAdditionalBindCredentials("uid=admin,ou=system", "secret");
  6. config.setListenerConfigs(InMemoryListenerConfig.createLDAPConfig("LDAP", port));
  7. config.setEnforceSingleStructuralObjectClass(false);
  8. config.setEnforceAttributeSyntaxCompliance(true);
  9. Entry entry = new Entry(new DN(defaultPartitionSuffix));
  10. entry.addAttribute("objectClass", "top", "domain", "extensibleObject");
  11. entry.addAttribute("dc", defaultPartitionName);
  12. InMemoryDirectoryServer directoryServer = new InMemoryDirectoryServer(config);
  13. directoryServer.add(entry);
  14. directoryServer.startListening();
  15. return new EmbeddedLdapServer(directoryServer);
  16. }

相关文章