@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); } }
final RDN originalRDN = dn.getRDN(); final Entry updatedEntry = originalEntry.duplicate(); updatedEntry.setDN(newDN);
/** * Retrieves the RDN for this entry. * * @return The RDN for this entry, or {@code null} if the DN is the null DN. * * @throws LDAPException If the DN string cannot be parsed as a valid DN. */ public final RDN getRDN() throws LDAPException { return getParsedDN().getRDN(); }
/** * Retrieves the RDN for this entry. * * @return The RDN for this entry, or {@code null} if the DN is the null DN. * * @throws LDAPException If the DN string cannot be parsed as a valid DN. */ public RDN getRDN() throws LDAPException { return getParsedDN().getRDN(); }
/** * Retrieves the RDN for this entry. * * @return The RDN for this entry, or {@code null} if the DN is the null DN. * * @throws LDAPException If the DN string cannot be parsed as a valid DN. */ public RDN getRDN() throws LDAPException { return getParsedDN().getRDN(); }
/** * Retrieves the RDN for this entry. * * @return The RDN for this entry, or {@code null} if the DN is the null DN. * * @throws LDAPException If the DN string cannot be parsed as a valid DN. */ public final RDN getRDN() throws LDAPException { return getParsedDN().getRDN(); }
/** * Set the authorizations for the roles which may be defined. If the keys are DN values, the application role names * are taken from the leftmost RDN value. Use {@link LdapAuthenticationService#setNamedRoles(Map)} instead of this * method to explicitly define application role names. * * @param roles map with roles, keys are the values for {@link #rolesAttribute}, probably DN values * @since 1.10.0 (actually already from 1.9.0 but annotations was missing) */ @Api public void setRoles(Map<String, List<AuthorizationInfo>> roles) { Map<String, List<NamedRoleInfo>> namedRoles = new HashMap<String, List<NamedRoleInfo>>(); for (String ldapRole : roles.keySet()) { DN dn; List<AuthorizationInfo> auth = roles.get(ldapRole); NamedRoleInfo role = new NamedRoleInfo(); role.setAuthorizations(auth); try { dn = new DN(ldapRole); role.setName(dn.getRDN().getAttributeValues()[0]); } catch (LDAPException e) { role.setName(ldapRole); } namedRoles.put(ldapRole, Collections.singletonList(role)); } setNamedRoles(namedRoles); }
try rdn = entry.getParsedDN().getRDN();
final RDN rdn = parsedDN.getRDN(); for (final String name : names)
@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); } }
final RDN rdn = dn.getRDN(); final String[] rdnAttrNames = rdn.getAttributeNames(); final byte[][] rdnAttrValues = rdn.getByteArrayAttributeValues();
final RDN parsedOldRDN = parsedOldDN.getRDN(); final DN parsedOldSuperiorDN = parsedOldDN.getParent();
final RDN parsedOldRDN = parsedOldDN.getRDN(); final DN parsedOldSuperiorDN = parsedOldDN.getParent();