7.7 LDAP Based Connectors

LDAP connector helps the user in communicating with LDAP based communication systems. The following connectors use LDAP communication:

  • AD Connector.

  • EDir Connector.

  • LDAP Connector.

Connector Actions: The actions that are available in the test or template:

7.7.1 Retrieve a Value

Retrieve a value from a directory and use that value in the test.

There are actions that get LDAP values into variables, and those variables can be referenced at any time during test execution. These actions are as follows:

  • Get Object (Fully Distinguished Name) FDN and Set Variable. This action search the tree from a specific Base DN for an object whose attributes have values specified by you. The variable is set to the object FDN. If the object is not found, the variable is simply assigned an empty value, but no error is returned.

    NOTE:Be sure to populate the Base DN field, if you do not populate, the search may not work on some LDAP servers.

  • Get Values and Set Variable. This action sets the variable value to the first value from the specified attribute unless the “Get All Values” box is checked.

“Get All Values” will return all values for the attribute as a Json array that can be referenced in Javascript or the Parse Json action in the Generic connector.

The Parse Json action acts upon the variable as a Json object. For example, to get the first value of a Json array the Json expression would simply be: [0].

To access the variable in Javascript you treat the variable as a Json object. For example, if the variable name is MyVar you would get the first value in the array with: js:{ ${MyVar}[0] }

7.7.2 Create Object

Create Object action Imports Fields from the Object link.

If you have an existing object in the directory that is similar to the object you are creating in Identity Validator, you can import all attributes from that object which will automatically populate the Classes and Attributes fields in the Create Object action.

NOTE:If you want to ignore specific attributes during the Import, specify a comma separated list of attribute names (case sensitive) in the connector property Ignore Attributes.

There are two import links in this action - you can either browse the tree for an object, or specify an object DN in the Object FDN field.

IMPORTANT:You may need to remove some of the imported classes and attributes since some of them may not be applicable or even writable to the specific directory you are accessing.

7.7.3 Setting dates

Setting dates such as passwordExpirationTime:

Version 1.3 introduced time calculation and conversion actions in the Generic Connector. You can generate LDAP dates for use in LDAP Based Connectors.

This information helps you understand how the date format should be in LDAP.

The LDAP date should be in YYYYMMDDHHMMSSZ format.

For example: Jan 15, 2011 at 1:05:23 PM is 20110115130523Z for zulu (UTC) time.

To specify time for your own timezone, replace Z with UTC time offset in the form: +|-HHMM where HHMM represents the number of hours and minutes in relation to UTC time.

For example: 20110115130523-0500 is 5 hours behind UTC time which is Eastern Standard Time.

NOTE:Use the Date Calculator in the Generic Actions connector to create and convert dates.

7.7.4 Deleting Objects

For deleting Objects using wild-cards, you can use wildcards in the CN value for Delete Objects and Assert Object Exists. For example: cn=testuser*,ou=myou,o=myo would match all users whose CN starts with “testuser”. Only * is allowed as a wildcard.

7.7.5 Bulk Create Objects

Bulk Create Objects action allows you to create users in bulk for performance testing. It is similar to the Create Object action but has some additional fields for a starting counter, the number of objects to create, and the delay between each creation.

You can access the current counter value to create unique attribute values, by using the string “CTR” anywhere within the value. For example: JohnsonCTR would result in the value Johnson1, Johnson2, and so on.

7.7.6 Save or Restore Object

Save or Restore Object action allows you to take a snapshot of an object and store it in a variable so it can be restored later. The restore is performed by deleting the existing object, then creating a new object based on the saved object.

When saving an object you may wish to ignore certain attributes. These may include system attributes that cannot be written via LDAP to an object, or other attributes you simply wish to ignore. There is a property in the connector configuration called Ignore Attributes where you can provide a comma separated list of attributes that ignores during an object Import and Save. This attribute names in this list are case sensitive. If this property is left blank, a default list of system attributes is used (mostly for AD objects) to avoid errors during object creation or a restore.

7.7.7 Troubleshooting Save and Restore

If an attribute is saved but cannot be restored, you may see the following errors during a restore process:

  • Error while executing action method saveRestoreObject: java.lang.AssertionError: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1.

  • This means that an attribute contains binary data that cannot be represented in Json so the Json parser throws an error. This attribute can be ignored.

  • Unwilling To Perform (53) Unwilling To Perform LDAPException: Server Message: 0000209A: SvcErr: DSID-031A0FBB, problem 5003 (WILL_NOT_PERFORM), data 0

    In this case, the server is indicating that an attribute cannot be written using LDAP.

  • Determining troublesome attributes may be tricky and is a trial and error process. You can look at the variable containing the saved object by using the Generic Actions Base 64 Decode action. This allows you to see which attributes were saved, then you can add attributes one at a time to the Ignore Attributes property on the connection until subsequent Save and Restore operations succeed. If an attribute looks like it contains binary data (such as odd characters in the Json) you might ignore that attribute as well.