Skip to main content
Version: 1.1

JSON Parser sample configuration

In this example, the attribute connector is configured to parse the contents of the attribute pip.payload, which originated from the JSON Attribute Connector. The parsing uses the parameterized JSONPath expression $.authorizations[?(@.id=='##1##')].status to extract values.

note

The parameter ##1## within the expression is populated by the value of the attribute pip.username.

Finally, the extracted values are provided to the connector host in the attribute pip.status.

jsonParser.config.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns="http://www.axiomatics.com/attributeconnector/parser/json/configuration"
identifier="json-parser">
<source>
<xacmlAttribute AttributeId="pip.payload"
Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject"
DataType="http://www.w3.org/2001/XMLSchema#string"/>
</source>
<mapping>
<xacmlAttribute AttributeId="pip.status"
Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject"
DataType="http://www.w3.org/2001/XMLSchema#string"/>
<jsonPath>$.authorizations[?(@.id=='##1##')].status</jsonPath>
<key>
<xacmlAttribute AttributeId="pip.username"
Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject"
DataType="http://www.w3.org/2001/XMLSchema#string"/>
</key>
</mapping>

In this configuration, when the connector is queried for the attribute pip.status with the following values:

  • pip.payload as { "authorizations": [ { "id": "a123", "status": "ok"} ] }
  • pip.username as a123

it will return ok.