Using the Agent Toolkit with Apache Commons MultiMap

Multi-valued attributes are received as an org.apache.commons.collections.MultiMap collection of attributes.

try {    
   //see "Using the Agent API" section for sample code    
   //that instantiates and configures an Agent instance    
   MultiMap userInfo = agent.readTokenToMultiMap(request);    
   if(userInfo != null) {       
     String username = (String)((List)userInfo.get(Agent.TOKEN_SUBJECT)).get(0);       
     List groups = (List)userInfo.get("GROUP");    
   } 
} 
catch(TokenException e) {    
    // Handle exception 
}

Using the PingFederate MultiMap equivalent

try
{
    //see “Using the Agent API” section for sample code
    //that instantiates and configures an Agent instance
    PingFederateMultiMap userInfo = agent.readTokenToNativeMultiMap(request);
    if (null != userInfo)
    {
        String username = (String) (userInfo.get(Agent.TOKEN_SUBJECT)).get(0);
        List groups = userInfo.get(“GROUP”);
    }
}
catch (TokenException e)
{
    // Handle exception
}