Sample configuration
The following is a sample configuration for the HTTP Attribute Connector. In this example, the connector has been configured to connect to the “Mock Service” located at URL http://djob-hp:8280/mock/mock.
The configuration contains a single mapping:
- the XACML attribute
pip.payloadwill be retrieved from the web service based on the key attributepip.usernameand the message payload template located at/request.template.json(on the classpath).
- XML
- JSON
- YAML
http.config.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns="http://www.axiomatics.com/http.config" identifier="http-parser">
<connection>
<url>http://djob-hp:8280/mock/mock</url>
<keystore file="keystore.jks" password="changeit" type="JKS"></keystore>
<truststore file="truststore.jks" type="JKS" password="changeit"></truststore>
<header>
<name>Accept-Language</name>
<value>en-EN</value>
</header>
<method>POST</method>
<!-- Consider the following as 200 and return the payload in the relevant attribute -->
<acceptedHttpCode>404</acceptedHttpCode>
<!-- Make the following codes silent errors and return an empty value in the relevant attribute -->
<ignoredHttpCode>405</ignoredHttpCode>
<ignoredHttpCode>406</ignoredHttpCode>
</connection>
<mapping>
<xacmlAttribute Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="pip.payload" DataType="http://www.w3.org/2001/XMLSchema#string" Issuer=""/>
<contentType>application/json</contentType>
<template classpath="true" payload="false">/request.template.json</template>
<key>
<xacmlAttribute Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="pip.username" DataType="http://www.w3.org/2001/XMLSchema#string" Issuer=""/>
</key>
</mapping>
</configuration>
JSON configuration files offer the option to use either ALFA or XACML for attribute definitions.
- XACML
- ALFA
http.config.json
{
"identifier": "http-parser",
"connection": {
"url": "http://djob-hp:8280/mock/mock",
"keystore": {
"file": "keystore.jks",
"password": "changeit",
"type": "JKS"
},
"truststore": {
"file": "truststore.jks",
"type": "JKS",
"password": "changeit"
},
"headers": [
{
"name": "Accept-Language",
"value": "en-EN"
}
],
"method": "POST",
"acceptedHttpCodes": [
404
],
"ignoredHttpCodes": [
405,
406
]
},
"mappings": [
{
"xacmlAttribute": {
"category": "urn:oasis:names:tc:xacml:1.0:subject-category:access-subject",
"attributeId": "pip.payload",
"datatype": "http://www.w3.org/2001/XMLSchema#string",
"issuer": ""
},
"contentType": "application/json",
"template": {
"classpath": true,
"payload": false,
"value": "/request.template.json"
},
"keys": [
{
"xacmlAttribute": {
"category": "urn:oasis:names:tc:xacml:1.0:subject-category:access-subject",
"attributeId": "pip.username",
"datatype": "http://www.w3.org/2001/XMLSchema#string",
"issuer": ""
}
}
]
}
]
}
http.config.alfa.json
{
"identifier": "http-parser",
"connection": {
"url": "http://djob-hp:8280/mock/mock",
"keystore": {
"file": "keystore.jks",
"password": "changeit",
"type": "JKS"
},
"truststore": {
"file": "truststore.jks",
"type": "JKS",
"password": "changeit"
},
"headers": [
{
"name": "Accept-Language",
"value": "en-EN"
}
],
"method": "POST",
"acceptedHttpCodes": [
404
],
"ignoredHttpCodes": [
405,
406
]
},
"mappings": [
{
"attributeName": "pip.payload",
"contentType": "application/json",
"template": {
"classpath": true,
"payload": false,
"value": "/request.template.json"
},
"keys": [
{
"attributeName": "pip.username"
}
]
}
]
}
YAML configuration files offer the option to use either ALFA or XACML for attribute definitions.
- XACML
- ALFA
http.config.yaml
identifier: "http-parser"
connection:
url: "http://djob-hp:8280/mock/mock"
keystore:
file: "keystore.jks"
password: "changeit"
type: "JKS"
truststore:
file: "truststore.jks"
type: "JKS"
password: "changeit"
headers:
- name: "Accept-Language"
value: "en-EN"
method: "POST"
acceptedHttpCodes:
- 404
ignoredHttpCodes:
- 405
- 406
mappings:
- xacmlAttribute:
category: "urn:oasis:names:tc:xacml:1.0:subject-category:access-subject"
attributeId: "pip.payload"
datatype: "http://www.w3.org/2001/XMLSchema#string"
issuer: ""
contentType: "application/json"
template:
classpath: true
payload: false
value: "/request.template.json"
keys:
- xacmlAttribute:
category: "urn:oasis:names:tc:xacml:1.0:subject-category:access-subject"
attributeId: "pip.username"
datatype: "http://www.w3.org/2001/XMLSchema#string"
issuer: ""
http.config.alfa.yaml
identifier: "http-parser"
connection:
url: "http://djob-hp:8280/mock/mock"
keystore:
file: "keystore.jks"
password: "changeit"
type: "JKS"
truststore:
file: "truststore.jks"
type: "JKS"
password: "changeit"
headers:
- name: "Accept-Language"
value: "en-EN"
method: "POST"
acceptedHttpCodes:
- 404
ignoredHttpCodes:
- 405
- 406
mappings:
- attributeName: "pip.payload"
contentType: "application/json"
template:
classpath: true
payload: false
value: "/request.template.json"
keys:
- attributeName: "pip.username"