[7211a95] | 1 | # |
---|
| 2 | # This example shows how a parameterized role can be used to infer a role and |
---|
| 3 | # that the same role can also be directly assigned. The example has 4 |
---|
[f824a9e] | 4 | # principals, the Acme company, a Coyote, a RoadRunner and a Jackrabbit. |
---|
[7211a95] | 5 | # |
---|
| 6 | # The policy of the Acme company is that anyone the Acme company thinks is a |
---|
| 7 | # friend of the Roadrunner is a preferred customer. A friend of the roadrunner |
---|
| 8 | # has the [keyid:Acme}.role:friendOf([keyid:Roadrunner]) role, and a preferred |
---|
| 9 | # customer has the [keyid:Acme].role:preferred_customer role. |
---|
| 10 | # |
---|
[f824a9e] | 11 | # setup.py script creates the 4 principal: Acme, Coyote, Roadrunner and |
---|
| 12 | # Jackrabbit. |
---|
| 13 | # attr.py script creates 3 policy credentials, Credential 1 lays out the rule |
---|
[7211a95] | 14 | # that friends of the Roadrunner are preferred customers. Credential 2 |
---|
| 15 | # directly makes the Coyote a preferred customer. Credential 3 recognizes that |
---|
| 16 | # Acme thinks that the Jackrabbit is the Roadrunner's friend. |
---|
| 17 | # |
---|
[f824a9e] | 18 | # The query.py script tests whether the coyote is a friend of the |
---|
| 19 | # Roadrunner (which fails), whether the Jackrabbit is a friend of the |
---|
[7211a95] | 20 | # Roadrunner (which succeeds), whether the Jackrabbit is a preferred customer |
---|
| 21 | # (which succeeds), whether the Coyote is a prefered customer (succeeds for a |
---|
| 22 | # different reason) and whether the system fails to load a bad certificate (it |
---|
| 23 | # does). |
---|
[f824a9e] | 24 | # |
---|
[7211a95] | 25 | # acme_friend_rt1 |
---|
[f824a9e] | 26 | # |
---|
| 27 | # Credential 1 |
---|
[7211a95] | 28 | #[keyid:Acme].role:preferred_customer <- [keyid:Acme].role:friendOf([keyid:Roadrunner]) |
---|
| 29 | |
---|
[f824a9e] | 30 | # Credential 2 |
---|
[7211a95] | 31 | #[keyid:Acme].role:prefered_customer <- [keyid:Coyote] |
---|
| 32 | |
---|
[f824a9e] | 33 | # Credential 3 |
---|
[7211a95] | 34 | #[keyid:Acme].role:friendOf([keyid:Roadrunner]) <- [keyid:Jackrabbit] |
---|
| 35 | |
---|