I am very new to XACML. And I am using XACML to express policy. But I can't find any good examples except a few from the OASIS XACML Technical Committee.
Ok, here is my question:
I want to express policy using XACML. Users can access to the resources only if they satisfy the policy. The policy is an logical expression. For example:
(not A1) and (A2 OR A3) and (2 of (A4, A5,A6))
2 of (A4,A5,A6) refers that it is true only if 2 or more of A4,A5,A6 is true.
"AllOf" and "AnyOf" can be used to express "AND" and "OR", but I don't know how to express "2 of (A4,A5,A6)" and "not A1".
Thank you!
Based on the requirement you have, you need to use a XACML condition. Conditions live within rules only so this means you'll have to put your logic inside the rule.
This is because you will need a function not allowed in XACML targets: n-of.
This is also because a XACML Target cannot have negative expressions. The only way you can express Not(A1) is via a condition.
The reason for that is that XACML deals with attribute bags. So when you write in a target:
What you are in fact saying is: if the user has at least one role equal to manager...
So what would the opposite of that be?
With respect to your 2 of (a,b,c), you can use the XACML function called n-of (urn:oasis:names:tc:xacml:1.0:function:n-of defined in A.3.5 Logical functions)
The outcome is in ALFA
In the example above I made A1 through A6 string attributes instead of boolean to show how you would compare with values. Note that I have to use the stringOneAndOnly function to make sure there is a single value for each of the attributes used in the nOf function.
The XACML output is the following:
--- EDIT ---
To express negative conditions e.g. not(gender==male), you have two options:
In the former case you can write the following:
In the latter case, you need to write a negative condition. To do that you need to use a XACML condition. Since XACML conditions only live inside rules, you need to go down to the XACML Rule level.