Page created: 24 Jul 2019
|
Page updated: 8 Feb 2022
The Agent Toolkit for Java supports receiving multi-value attributes in the SAML assertion from PingFederate.
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
}