@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); } }
@Override public List<String> getAttributeValues() { if (attributeValuesCache == null) { attributeValuesCache = Arrays.asList(rdn.getAttributeValues()); } return attributeValuesCache; }
@Override public List<String> getAttributeValues() { if (attributeValuesCache == null) { attributeValuesCache = Arrays.asList(rdn.getAttributeValues()); } return attributeValuesCache; }
for (RDN rdn : new DN(group).getRDNs()) { if (rdn.hasAttribute("cn")) { roles.addAll(Arrays.asList(rdn.getAttributeValues())); break;
for (RDN rdn : new DN(group).getRDNs()) { if (rdn.hasAttribute("cn")) { roles.addAll(Arrays.asList(rdn.getAttributeValues())); break;
for (final String s : rdns[i].getAttributeValues())
final String[] values = rdn.getAttributeValues(); for (int i=0; i < names.length; i++)
/** * 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); }
final String[] values = rdnObject.getAttributeValues(); if (noTypes)
final String[] values = originalRDNs[i].getAttributeValues(); for (int j=0; j < names.length; j++) final String[] origValues = originalRDNs[0].getAttributeValues(); for (int i=0; i < origNames.length; i++) final String[] originalRDNValues = originalRDNs[0].getAttributeValues();
final String[] originalValues = originalRDNs[i].getAttributeValues(); final String[] newValues = new String[originalValues.length]; for (int j=0; j < names.length; j++)
@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); } }