I am writing a XACML policies for my masters dissertation, and I am encountering apparent syntax errors. It is highlighting the very first line; however, I am unsure. I am very new to XML so that it may be a very silly mistake :)
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<PolicySet xsi:schemaLocation="urn:oasis:names:tc:xacml:2.0:policy:schema:os
C:\Users\home\OneDrive\Documents\core-release Authzforce Testing\IIA001" PolicySetId="CAVPolicies"
PolicyCombiningAlgId="urn:oasis:names:tc:xacml:1.0:policy-combining-algorithm:permit-unless-
deny" xmlns="urn:oasis:names:tc:xacml:2.0:policy:schema:os"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Target xmlns="urn:oasis:names:tc:xacml:2.0:policy:schema:os">
</Target>
<Policy PolicyId=CAV1 RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:permit-unless-deny">
<Target/>
<Rule RuleId="CAVRSU" Effect="Deny">
<Description>Vehicles will relay data to a roadside unit upon request. Attempts to read vehicle path histories, applicable lane numbers.
Calculates chance of a vehicle committing a stop violation. </Description>
<Condition>
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:and">
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-at-least-one-member-of">
<SubjectAttributeDesignator AttributeId="CommunicationStructure" DataType="http://www.w3.org/2001/XMLSchema#string"/>
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-bag">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">RSU</AttributeValue>
</Apply>
</Apply
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-at-least-one-member-of">
<ResourceAttributeDesignator AttributeId="CAVData" DataType="http://www.w3.org/2001/XMLSchema#string"/>
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-bag">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Vehicle Path History</AttributeValue>
</Apply>
</Apply>
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:any-of">
<Function FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal"/>
<ActionAttributeDesignator DataType="http://www.w3.org/2001/XMLSchema#string" AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"/>
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">READ</AttributeValue>
</Apply>
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:or">
<Function FunctionId="urn:oasis:names:tc:xacml:1.0:function:boolean-equal"/>
<EnvironmentAttributeDesignator DataType="http://www.w3.org/2001/XMLSchema#boolean" AttributeId="VehicleWithinRSURange"/>
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#boolean">True</AttributeValue>
</Apply>
</Apply>
</Apply>
</Condition>
</Rule>
</Policy>
</PolicySet>
For reference, I am writing these policies in Notepad++ and then testing them in authforce PDP. When I run this in authforce, I get the error...
"Exception in thread "main" java.lang.reflect.InvocationTargetException"
Any feedback on anything is greatly appreciated :)
You should get used to finding and using tools. I doubt you will get much reponse for questions like this :) Having said that here is your modified xml that does not give error. In notepad++ you have plugin "XML Tools". If you install that, and if you try to save invalid xml it would give you error. You can also display the xml in your favourite browser and get error message. You can see the difference in xml you gave and one I put below using a diff utility, I use "winmerge (winmerge.com)"
In short the problem was:
extra "Apply" tag
not closed "Apply" tag
missing double quotes for policyId attribute value
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<PolicySet xsi:schemaLocation="urn:oasis:names:tc:xacml:2.0:policy:schema:os " PolicySetId="CAVPolicies" PolicyCombiningAlgId="urn:oasis:names:tc:xacml:1.0:policy-combining-algorithm:permit-unless-deny" xmlns="urn:oasis:names:tc:xacml:2.0:policy:schema:os"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Target xmlns="urn:oasis:names:tc:xacml:2.0:policy:schema:os">
</Target>
<Policy PolicyId="CAV1" RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:permit-unless-deny">
<Target/>
<Rule RuleId="CAVRSU" Effect="Deny">
<Description>Vehicles will relay data to a roadside unit upon request. Attempts to read vehicle path histories, applicable lane numbers.
Calculates chance of a vehicle committing a stop violation. </Description>
<Condition>
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:and">
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-at-least-one-member-of">
<SubjectAttributeDesignator AttributeId="CommunicationStructure" DataType="http://www.w3.org/2001/XMLSchema#string"/>
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-bag">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">RSU</AttributeValue>
</Apply>
</Apply>
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-at-least-one-member-of">
<ResourceAttributeDesignator AttributeId="CAVData" DataType="http://www.w3.org/2001/XMLSchema#string"/>
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-bag">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Vehicle Path History</AttributeValue>
</Apply>
</Apply>
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:any-of">
<Function FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal"/>
<ActionAttributeDesignator DataType="http://www.w3.org/2001/XMLSchema#string" AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"/>
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">READ</AttributeValue>
</Apply>
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:or">
<Function FunctionId="urn:oasis:names:tc:xacml:1.0:function:boolean-equal"/>
<EnvironmentAttributeDesignator DataType="http://www.w3.org/2001/XMLSchema#boolean" AttributeId="VehicleWithinRSURange"/>
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#boolean">True</AttributeValue>
</Apply>
</Apply>
</Condition>
</Rule>
</Policy>
</PolicySet>