Examples of requests and responses
This section describes some basic examples of requests and responses for authorization decisions.
The authorization decisions displayed in the examples below include the following:
- Permit
- Deny
- NotApplicable
- Indeterminate
Setup for examples:
For the following examples the preconditions used are listed below:
- Access Decision Service is running on localhost, port 8080
- TLS is not used
- The authentication property is on and set to
Basic
- The domain property is configured with a file reference to the YAML-format configuration file provided in the Additional resources section Authorization decisions domain file.
The YAML-format authorization domain file mentioned above must be used when running the requests detailed below. Failure to do so will result in the sample responses provided not aligning with the actual requests.
Example 1: Permit request using curl
Request
curl --data @request_permit.json -H content-type:application/xacml+json http://localhost:8080/authorize -u ads-user:secret
Explanation
The content-type
header tells Access Decision Service that the request will contain a XACML request in JSON format.
The --data
flag indicates that content is stored in a file called request_permit.json
.
Example 2: Permit
Request
A sample (request_permit.json
) containing a request message body for Permit is available in the Additional resources JSON-format request samples. It will produce the response given below.
Response
{
"Response": [
{
"Decision": "Permit"
}
]
}
Example 3: Deny
Request
A sample (request_deny.json
) containing a request message body for Permit is available in the Additional resources JSON-format request samples. It will produce the response given below.
Response
{
"Response": [
{
"Decision": "Deny"
}
]
}
Example 4: NotApplicable
Request
A sample (request_notapplicable.json
) containing a request message body for Permit is available in the Additional resources JSON-format request samples. It will produce the response given below.
Response
{
"Response": [
{
"Decision": "NotApplicable"
}
]
}
Example 5: Indeterminate
Request
A sample (request_indeterminate.json
) containing a request message body for Permit is available in the Additional resources JSON-format request samples. It will produce the response given below.
Response
{
"Response": [
{
"Decision": "Indeterminate",
"Status": {
"StatusMessage": "urn:oasis:names:tc:xacml:1.0:function:boolean-one-and-only
expects a bag that contains a single element,got a bag with 0 elements",
"StatusCode": {
"Value": "urn:oasis:names:tc:xacml:1.0:status:processing-error"
}
}
}
]
}
XML
XML versions of the request message body samples are available in the Additional resources XML-format request samples.