The Agent Toolkit for PHP supports passing multi-value attributes to PingFederate that will each appear in its own discrete <AttributeValue> element in the SAML 2.0 assertion or as a JSON array value in OAuth-based protocols. Multi-value attributes are passed using the MultiStringArray PHP class distributed with the Agent Toolkit for PHP.

The following code snippet demonstrates how to pass multi-valued attributes using the Agent Toolkit for PHP:

    # Use and instantiate an agent
    use pingidentity\opentoken\agent;

 use pingidentity\opentoken\helpers\multistringarray;
    $myagent = new Agent();

    # Setup an array of values
    $myvalues = MultiStringArray()

    # Single Value Attribute
    $myvalues->add(TOKEN_SUBJECT, <$userId>);

    #Multiple Value Attribute
    $myvalues->add(“MultiValueAttr”, “value1”);
    $myvalues->add(”MultiValueAttr”, ”value2”);
    $myvalues->add(“MultiValueAttr”, “value3”);

    # Generate and write the token to a cookie (assuming that's
    # our configuration)