000022371 - Excessive LDAP calls for simple RSA ClearTrust API user search

Document created by RSA Customer Support Employee on Jun 16, 2016Last modified by RSA Customer Support Employee on Apr 21, 2017
Version 2Show Document
  • View in full screen mode

Article Content

Article Number000022371
Applies ToRSA ClearTrust 5.5.3 Administrative API
IssueExcessive LDAP calls for simple RSA ClearTrust API user search
How to reduce the number of LDAP searches executed by a user search via RSA ClearTrust Administrative API
The following code returns n users, but executes the search n times:

IUserSearch userSearch = serverProxy.searchUserObjects( ) ;
userSearch.putUserPropertyCriterion( ... ) ;
ISparseData usersInSearch = userSearch.search( ) ;
IAPIObject[ ] retObj = usersInSearch.getByRange( 0, Integer.MAX_VALUE ) ;

int numOfUsers = retObj.length ;
IAPIObject[ ] userArray = usersInSearch.getByRange( 0, numOfUsers ) ;
ResolutionThis code is adapted from the example provided in the SDK documentation. It's unnecessary to make two .getByRange( ) calls to the API, the first to retrieve the number of entities returned, and the second to retrieve exactly that number, since the array returned by ISparseData.getObjectsByRange( 0, Integer.MAX_VALUE ) has a determinate length property. The second call is redundant, and is the cause of multiple repetitive searches.

NOTE: With the ISparseData data structure, it's not possible to retrieve the size of the dataset returned for any given query without actually executing the query in the datastore, with the concomitant performance cost. Thus, an ISparseData does not have a retrievable size property aside from actually retrieving the dataset.
Legacy Article IDa28062