000022319 - How to make an IUniqueIdentifier object available for a Web page

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 Number000022319
Applies ToRSA ClearTrust 5.0.1 Administrative Java API
IssueHow to make an IUniqueIdentifier object available for a Web page
CauseA common use of the Java Admin API is to build a custom user interface for administration. A typical GUI application characteristic is to provide a selection list (e.g. a list of peoples' UserID values):

 - Print a list of candidate items (keys)
 - Let end-user select an item
 - Retrieve all data from database based on the selected key

This processing sequence can be implemented relatively easily with Java primitive types (e.g. integer, string, dword, etc). RSA ClearTrust objects are referenced as IUniqueIdentifier type objects, a non-primitive type. See JavaDoc pages for more specific information regarding IUniqueIdentifier.

ResolutionThe IUniqueIdentifier object is serializable, i.e. it will allow itself to be stored and then retrieved for a later purpose.

An IUniqueIdentifier object can be converted to a printable form by serializing the object into a stream of base64-encoded characters. For example:

        //  Query user "jdoe"
        IUser user=(IUser)serverProxy.getUsers().getByName("jdoe");
        IUniqueIdentifier id=user.getUniqueIdentifier();

        /* Implement a Java class "Base64OutputStream" that extends java.io.ByteArrayOutputStream to convert the streamed object to a base64 encoding. */
        Base64OutputStream stream = new Base64OutputStream();
        ObjectOutputStream output = new ObjectOutputStream(stream);

The output streaming object could not be interrogated to obtain the Base64 representation that could be transmitted on an HTML page, for example:

        String bstring = stream.encoded();

Upon deserialization, Base64 decode the streamed object to recover the target IUniqueIdentifier object.

NOTE: This would require implementing a Java class "Base64InputStream" that extends java.io.ByteArrayInputStream

Legacy Article IDa18853