Modifying the UserMappingRepositoryLDAP sample file (Java programming language)
The UserMappingRepositoryLDAP.java file for the Java™ plug-in contains the functions for connecting to the LDAP server, retrieving user mappings, and disconnecting. Modify the sample code to match the object classes that are defined in the directory structure of your LDAP server.
About this task
- Remote server name
- Instance name
- Database name
- Remote user name
- Remote user password
The sample code assumes that the user entry is identified by the inetOrgPerson object class and that the user mapping entry is identified by the IIUserMapping object class. The Lightweight Directory Interchange Format (LDIF) sample files, schema.ldif and entry.ldif, load the sample schema and sample entries into the LDAP server.
The
code in the UserMappingRepositoryLDAP.java file assumes
that the schema.ldif file contains the LDIF code for
objects and attributes that have the following names:
- IIUserMapping object
- IIRemoteServerName attribute
- IIInstanceName attribute
- IIDatabaseName attribute
- IIRemotePassword attribute
- uid attribute
To modify the schema that the UserMappingRepositoryLDAP.java file uses:
Procedure
-
Locate the code:
private String UserObjectClassName = "inetOrgPerson"
and replace the inetOrgPerson value with the name of the object class that your LDAP server uses for user entries. - Optional: Change the attribute names that the plug-in uses. Replace the values for the IIRemoteServerAttrName, IIInstanceAttrName, IIDatabaseAttrName, and IIRemotePasswordAttrName variables with the attribute names that you choose.
- Optional: If you use the LDIF files, ensure that the schema in the LDIF files matches the structure that the UserMappingRepositoryLDAP.java file searches.