abac0-leakabac0-mei
Last change
on this file since 84038c8 was
ec550f7,
checked in by Mei <mei@…>, 11 years ago
|
1) reworked how API doc is generated
2) tweak top level Makefile.am
3) loading issuer principal as side-effect of loading
an attribute credentials
4) add examples of GENI specific attribute credentials
and principal certificates into the regression testing
5) rename examples to tests
|
-
Property mode set to
100755
|
File size:
1005 bytes
|
Line | |
---|
1 | #!/usr/bin/env python |
---|
2 | """ |
---|
3 | ctxtQuery1.py |
---|
4 | """ |
---|
5 | import os |
---|
6 | |
---|
7 | import ABAC |
---|
8 | ctxt = ABAC.Context() |
---|
9 | |
---|
10 | a = ABAC.ID("A", 24 * 3600 * 365 * 20) |
---|
11 | b = ABAC.ID("B", 24 * 3600 * 365 * 20) |
---|
12 | c = ABAC.ID("C", 24 * 3600 * 365 * 20) |
---|
13 | |
---|
14 | attr = ABAC.Attribute(a, "friendly_admin", 24 * 3600 * 365 * 20) |
---|
15 | attr.role(a.keyid(), "friendly") |
---|
16 | attr.role(a.keyid(), "admin") |
---|
17 | attr.bake() |
---|
18 | |
---|
19 | ctxt.load_id_chunk(a.cert_chunk()) |
---|
20 | ctxt.load_attribute_chunk(attr.cert_chunk()) |
---|
21 | |
---|
22 | attr = ABAC.Attribute(a, "friendly", 24 * 3600 * 365 * 20) |
---|
23 | attr.principal(b.keyid()) |
---|
24 | attr.bake() |
---|
25 | ctxt.load_attribute_chunk(attr.cert_chunk()) |
---|
26 | |
---|
27 | |
---|
28 | attr = ABAC.Attribute(a, "admin", 24 * 3600 * 365 * 20) |
---|
29 | attr.principal(b.keyid()) |
---|
30 | attr.bake() |
---|
31 | ctxt.load_attribute_chunk(attr.cert_chunk()) |
---|
32 | |
---|
33 | attr = ABAC.Attribute(a, "admin", 24 * 3600 * 365 * 20) |
---|
34 | attr.principal(c.keyid()) |
---|
35 | attr.bake() |
---|
36 | ctxt.load_attribute_chunk(attr.cert_chunk()) |
---|
37 | |
---|
38 | # Same code as above to initialize the ids and load the context |
---|
39 | |
---|
40 | ok, proof = ctxt.query(a.keyid() + ".friendly_admin", b.keyid()) |
---|
41 | |
---|
42 | print "ok? %d" %ok |
---|
Note: See
TracBrowser
for help on using the repository browser.