000022318 - How to retrieve RSA ClearTrust user's exportable properties through Runtime API

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 Number000022318
Applies ToRSA ClearTrust 5.5.x Runtime API
IssueHow to retrieve RSA ClearTrust user's exportable properties through Runtime API
When looping through keys in the result map from the RuntimeAPI.authenticate( ) method or the RuntimeAPI.authorize( ) method, casting the value for each key to a string throws a ClassCastException on processing the key ResultConstants.CT_USER_PROPERTIES
CauseWhen the call to authenticate or authorize a user is made over a connection for which OptionConstants.PROPERTIES_OPTION is set to OptionConstants.ON, the RSA ClearTrust Runtime API returns the exportable properties of the user as a java.util.Map under the key ResultConstants.CT_USER_PROPERTIES; the map contains string keys naming each property, and a java.util.Set of the values of that property (this allows for multi-valued properties to be correctly delimited in the data structure). Attempting to cast a java.util.Map as a java.lang.String causes a ClassCastException to be thrown.
ResolutionThe Java instanceof operator can be used to check whether or not the returned value for a key is of type java.util.Map:

HashMap result = runtimeProxy.authenticate( userMap ) ;
Iterator iter = result.keySet( ).iterator( ) ;
String key ;

Object value ;
while( iter.hasNext( ) )
    key = (String) iter.next( ) ;
    value = result.get( key ) ;
    if( value instanceof java.util.Map )
        printMap( (Map) value ) ;
        System.out.println( key + ": " + (String) value ) ;


See the Javadocs for sirrus.runtime.ResultConstants for the associated value for each possible key.
Legacy Article IDa27937