Skip to content

Commit 0faa874

Browse files
authored
Fixed json to escape ':'
1 parent 79ce2ec commit 0faa874

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The authorizer combines Kafka ACL evaluation with XACML evaluation as follows:
1515
* If ACL evaluation returns Permit, return Permit.
1616
* Else:
1717
* If XACML evaluation is disabled, return Deny.
18-
* Else return the result of XACML evaluation.
18+
* Else: If and only if the result of XACML evaluation is Permit, return Permit.
1919

2020
## Installation
2121
Get the `tar.gz` distribution from the [latest release on the GitHub repository](https://github.com/DRIVER-EU/kafka-combined-acl-xacml-authorizer/releases) and extract the files to some folder, e.g. `/opt/authzforce-ce-kafka-extensions`. You should have a `lib` folder inside.
@@ -37,14 +37,15 @@ To enable XACML evaluation, set the extra following authorizer properties:
3737
|`resourceType`|[org.apache.kafka.common.resource.ResourceType](https://kafka.apache.org/11/javadoc/org/apache/kafka/common/resource/ResourceType.html)|resource type|
3838
|`resourceName`|`String`|resource name|
3939

40-
4140
For example:
4241

4342
```json
44-
org.ow2.authzforce.kafka.pep.xacml.req.tmpl={"Request":{"Category":[{"CategoryId":"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject","Attribute":[{"AttributeId":"urn:oasis:names:tc:xacml:1.0:subject:subject-id","DataType":"http://www.w3.org/2001/XMLSchema#string","Value":"${principal.name}"},{"AttributeId":"urn:oasis:names:tc:xacml:1.0:subject:authn-locality:dns-name","DataType":"urn:oasis:names:tc:xacml:2.0:data-type:dnsName","Value":"${clientHost.hostName}"},{"AttributeId":"urn:oasis:names:tc:xacml:3.0:subject:authn-locality:ip-address","DataType":"urn:oasis:names:tc:xacml:2.0:data-type:ipAddress","Value":"${clientHost.hostAddress}"}]},{"CategoryId":"urn:oasis:names:tc:xacml:3.0:attribute-category:action","Attribute":[{"AttributeId":"urn:oasis:names:tc:xacml:1.0:action:action-id","DataType":"http://www.w3.org/2001/XMLSchema#string","Value":"${operation}",}]},{"CategoryId":"urn:oasis:names:tc:xacml:3.0:attribute-category:resource","Attribute":[{"AttributeId":"urn:thalesgroup:xacml:resource:resource-type","DataType":"http://www.w3.org/2001/XMLSchema#string","Value":"${resourceType}"},{"AttributeId":"urn:oasis:names:tc:xacml:1.0:resource:resource-id","DataType":"http://www.w3.org/2001/XMLSchema#string","Value":"${resourceName}"}]},{"CategoryId":"urn:oasis:names:tc:xacml:3.0:attribute-category:environment","Attribute":[{"AttributeId":"urn:thalesgroup:xacml:environment:deployment-environment","DataType":"http://www.w3.org/2001/XMLSchema#string","Value":"DEV"}]}]}}
43+
org.ow2.authzforce.kafka.pep.xacml.req.tmpl={"Request"\:{"Category"\:[{"CategoryId"\:"urn\:oasis\:names\:tc\:xacml\:1.0\:subject-category\:access-subject","Attribute"\:[{"AttributeId"\:"urn\:oasis\:names\:tc\:xacml\:1.0\:subject\:subject-id","DataType"\:"http\://www.w3.org/2001/XMLSchema#string","Value"\:"${principal.name}"},{"AttributeId"\:"urn\:oasis\:names\:tc\:xacml\:1.0\:subject\:authn-locality\:dns-name","DataType"\:"urn\:oasis\:names\:tc\:xacml\:2.0\:data-type\:dnsName","Value"\:"${clientHost.hostName}"},{"AttributeId"\:"urn\:oasis\:names\:tc\:xacml\:3.0\:subject\:authn-locality\:ip-address","DataType"\:"urn\:oasis\:names\:tc\:xacml\:2.0\:data-type\:ipAddress","Value"\:"${clientHost.hostAddress}"}]},{"CategoryId"\:"urn\:oasis\:names\:tc\:xacml\:3.0\:attribute-category\:action","Attribute"\:[{"AttributeId"\:"urn\:oasis\:names\:tc\:xacml\:1.0\:action\:action-id","DataType"\:"http\://www.w3.org/2001/XMLSchema#string","Value"\:"${operation}",}]},{"CategoryId"\:"urn\:oasis\:names\:tc\:xacml\:3.0\:attribute-category\:resource","Attribute"\:[{"AttributeId"\:"urn\:thalesgroup\:xacml\:resource\:resource-type","DataType"\:"http\://www.w3.org/2001/XMLSchema#string","Value"\:"${resourceType}"},{"AttributeId"\:"urn\:oasis\:names\:tc\:xacml\:1.0\:resource\:resource-id","DataType"\:"http\://www.w3.org/2001/XMLSchema#string","Value"\:"${resourceName}"}]},{"CategoryId"\:"urn\:oasis\:names\:tc\:xacml\:3.0\:attribute-category\:environment","Attribute"\:[{"AttributeId"\:"urn\:thalesgroup\:xacml\:environment\:deployment-environment","DataType"\:"http\://www.w3.org/2001/XMLSchema#string","Value"\:"DEV"}]}]}}
4544
```
4645

47-
This example is a result of compacting the [template in the source](src/test/resources/request.xacml.json.ftl) on one line. It should be sufficient for most cases.
46+
This example is derived from the [template in the source](src/test/resources/request.xacml.json.ftl), i.e. adapted for the Java Properties format, and should be applicable to most cases.
47+
48+
As shown in this example, the property value must be formatted according to [Java Properties API](https://docs.oracle.com/javase/8/docs/api/index.html?java/util/Properties.html). In particular, you must **either compact your JSON template on one line; or on multiple lines but only if you terminate each line with a backslash as mentioned on [Java Properties#load(Reader) API](https://docs.oracle.com/javase/8/docs/api/java/util/Properties.html#load-java.io.Reader-). You must also escape all ':' with backslash**, because ':' is a special character (like '=') in Java properties file format.
4849

4950
## Starting Kafka
5051
Make sure Zookeeper is started first:

0 commit comments

Comments
 (0)