This article provides a Business Logic Task Handler (BLTH) sample to automate UserID creation within CA Identity Manager. The logic generates a unique ID based on a combination of user attributes and includes an automated incrementing mechanism to prevent duplicate IDs.
UserID Generation Logic:
jda0200.jda0200 already exists, the third character increments (e.g., jdb0200, jdc0200) until a unique ID is found.Identity Manager 14.x & v15
To implement this custom UserID generation logic, follow the steps below:
Prerequisites
⚠️ IMPORTANT: Always test custom code in a non-production environment. Ensure you have a full backup of your Identity Manager configuration before implementing BLTH changes.
Implementation Steps
Create a new Java class named BLTHsetUID extending BLTHAdapter.
Implement the handleValidation method to extract %FIRST_NAME%, %LAST_NAME%, and departmentNumber.
Use the provided logic to generate and validate the unique UserID string.
Compile the code and deploy the resulting JAR file to the Identity Manager library path.
Code Sample (Java)
package com.ca.identitymanager.myblth;
import com.netegrity.imapi.BLTHAdapter;
import com.netegrity.imapi.BLTHContext;
import com.netegrity.ims.exception.IMSException;
import com.netegrity.llsdk6.imsapi.exception.NoSuchObjectException;
import com.netegrity.llsdk6.imsapi.managedobject.User;
import com.netegrity.llsdk6.imsapi.provider.UserProvider;
public class BLTHsetUID extends BLTHAdapter {
public void handleValidation(BLTHContext blthContext) throws Exception {
User user = blthContext.getUser();
String FirstName = user.getAttribute("%FIRST_NAME%");
String LastName = user.getAttribute("%LAST_NAME%");
String departmentNumber = user.getAttribute("departmentNumber");
if (FirstName.isEmpty() || LastName.isEmpty() || departmentNumber.isEmpty()) {
// this message will be presented on the screen
IMSException imsEx = new IMSException();
imsEx.addUserMessage("Failed to build an UID, first name, last name and department number are required");
throw imsEx;
}
String UID = FirstName.substring(0, 1) + LastName.substring(0, 1) + 'a' + departmentNumber;
UserProvider userbis = blthContext.getUserProvider();
for (char c='a'; c<='z'; c++){
try {
UID = FirstName.substring(0, 1) + LastName.substring(0, 1) + c + departmentNumber;
userbis.findUser(UID, null);
//UID already exists, search for next computed one
if (c=='z') {
// this message will be presented on the screen
IMSException imsEx = new IMSException();
imsEx.addUserMessage("Failed to find an UID, all UIDs already exist");
throw imsEx;
}
} catch (NoSuchObjectException nso){break;}
}
try {
blthContext.getUser().setAttribute("%USER_ID%", UID);
} catch (Exception ex) {
// this message will be presented on the screen
IMSException imsEx = new IMSException();
imsEx.addUserMessage("Failed to set an UID" + ex.getMessage());
throw imsEx;
}
}
}
Adapt with your department Number attribute name or well known name and other specific requirements.