Mapping Resource Attributes to LDAP Attributes — Service Connector API Example (Java)
Example code is provided that illustrates navigating an organization model using method calls available in the Service Connector API.
The step numbers in the comments correspond to the steps in the illustration, Mapping Resource Attributes to LDAP Attributes.
public void mapResourceAttributesToLdapAttributes(int aModelVersion) throws DirectoryEngineFault, SecurityFault { // Step 1: get details of all model entities in given major version GetOrgModelResponse model = getOrgModelService().getOrgModel(aModelVersion, false); XmlOrgAttribute[] resourceAttrs = model.getResourceAttributeArray(); // Step 2: get details of all configured LDAP Containers XmlContainer[] ldapContainers = getDirectoryService().listContainers(); // select an LDAP Container XmlContainer ldapContainer = ldapContainers[0]; // Step 3: retrieve names attributes from a select LDAP Connection XmlLdapQuerySource ldapSource = ldapContainer.getPrimaryLdap(); String alias = ldapSource.getLdapAlias(); String baseDn = ldapSource.getBaseDn(); String filter = ldapSource.getLdapQuery(); ListAttributeNamesResponse attributes = getDirectoryService().listAttributeNames(alias, baseDn, filter, 0); // select an LDAP attribute String ldapAttr = attributes.getAttributeArray(0).getName(); // assign resource attributes to LDAP attributes of primary LDAP // can also be performed on a secondary LDAP XmlLdapSource primaryLdap = ldapContainer.getPrimaryLdap(); primaryLdap.setAttributeMappingArray(null); // clear any original settings if necessary XmlLdapAttributeMapping mapping = primaryLdap.addNewAttributeMapping(); mapping.setResourceAttrGuid(resourceAttrs[0].getGuid()); mapping.setLdapAttribute(ldapAttr); // Step 4: save updated LDAP Container getDirectoryService().saveContainer(ldapContainer.getName(), ldapContainer.getDescription(), ldapContainer.getPrimaryLdap(), ldapContainer.getSecondaryLdapArray(), ldapContainer.getRestrictedOrgArray());
Copyright © Cloud Software Group, Inc. All rights reserved.