Creating a User
Before you can create a new user, you first have to obtain such LDAP attributes as:
-
parentDN
-
sAMAccountName
-
cn
-
sn
-
givenName
Once you have obtained these LDAP attributes, follow these steps to create a new user:
-
Obtain the LDAP attributes necessary for creating a user in Active Directory (for example, parentDN, sAMAccountName, cn, sn, and givenName).
-
Set up the enrollment data (user attributes) that must be conveyed to ActivID CMS:
CopyEnrollmentDataValue[] enrollmentValue =
new EnrollmentDataValue[5]; enrollmentValue[0] = new EnrollmentDataValue(); enrollmentValue[0].setId(“parentDN”); enrollmentValue[0].setType(EnrollmentData.
ENROLLMENT_DATA_TYPE_STRING);
enrollmentValue[0].setEncoding(EnrollmentData.
ENROLLMENT_DATA_ENCODING_NONE); enrollmentValue[0].setValue(parentDN); enrollmentValue[1] = new EnrollmentDataValue(); enrollmentValue[1].setId(“sAMAccountName”); enrollmentValue[1].setType(EnrollmentData.
ENROLLMENT_DATA_TYPE_STRING);
enrollmentValue[1].setEncoding(EnrollmentData.
ENROLLMENT_DATA_ENCODING_NONE); enrollmentValue[1].setValue(sAMAccountName); enrollmentValue[2] = new EnrollmentDataValue(); enrollmentValue[2].setId(“cn”); enrollmentValue[2].setType(EnrollmentData.
ENROLLMENT_DATA_TYPE_STRING);
enrollmentValue[2].setEncoding(EnrollmentData.
ENROLLMENT_DATA_ENCODING_NONE); enrollmentValue[2].setValue(cn); enrollmentValue[3] = new EnrollmentDataValue(); enrollmentValue[3].setId(“sn”); enrollmentValue[3].setType(EnrollmentData.
ENROLLMENT_DATA_TYPE_STRING);
enrollmentValue[3].setEncoding(EnrollmentData.
ENROLLMENT_DATA_ENCODING_NONE);
enrollmentValue[3].setValue(sn); enrollmentValue[4] = new EnrollmentDataValue(); enrollmentValue[4].setId(“givenName”); enrollmentValue[4].setType(EnrollmentData.
ENROLLMENT_DATA_TYPE_STRING);
enrollmentValue[4].setEncoding(EnrollmentData.
ENROLLMENT_DATA_ENCODING_NONE);
enrollmentValue[4].setValue(givenName); -
Instantiate a user ID object using the LDAP attribute sAMAccountName:
CopyUserId userId = new UserId(sAMAccountName);
-
Instantiate a User object using the enrollment data and the user ID:
CopyUser user = new User(userId, enrollmentValue);
Note: The unicodePwd attribute (user password) can only be changed if the connection to the Active Directory is secured using SSL or LDAPS (LDAP over SSL). -
Use the createUser method of the UserManager class to create a new user:
CopyuserMgr.createUser(user);