JSON Parser sample configuration
In this example, the attribute connector is configured to parse the contents of the XACML attribute pip.payload
, which originated from the HTTP Attribute Connector. The parsing uses the parameterized JSONPath expression $.authorizations[?(@.id=='##1##')].status
to extract values.**
The parameter ##1##
within the expression is populated by the value of the XACML attribute pip.username
.
**Finally, the extracted values are provided to the connector host in the XACML attribute pip.status
.
<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns="http://www.axiomatics.com/attributeconnector/parser/json/configuration"
identifier="mypip">
<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>
</configuration>
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
asa123
it will return ok
.