---
title: Receiving multi-value attributes
description: The Agent Toolkit for Java supports receiving multi-value attributes in the SAML assertion from PingFederate.
component: java
page_id: java:setup:pf_java_ik_receiving_multi_value_attributes
canonical_url: https://docs.pingidentity.com/integrations/java/setup/pf_java_ik_receiving_multi_value_attributes.html
revdate: June 21, 2024
section_ids:
  using-the-agent-toolkit-with-apache-commons-multimap: Using the Agent Toolkit with Apache Commons MultiMap
  using-the-pingfederate-multimap-equivalent: Using the PingFederate MultiMap equivalent
---

# Receiving multi-value attributes

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-value 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
}
```
