abac0-leakabac0-meicompt_changesgec13mei-idmei-rt0-nmei_rt0mei_rt2mei_rt2_fix_1meiyap-rt1meiyap1rt2tvf-new-xml
Last change
on this file since 5ce5780 was
55c272b,
checked in by Mike Ryan <mikeryan@…>, 14 years ago
|
remove libabac_init and libabac_deinit
|
-
Property mode set to
100755
|
File size:
1.1 KB
|
Line | |
---|
1 | #!/usr/bin/python |
---|
2 | |
---|
3 | import getopt |
---|
4 | import sys |
---|
5 | from ABAC import * |
---|
6 | import pprint |
---|
7 | |
---|
8 | def usage(): |
---|
9 | print "Usage: abac_prover.py \\" |
---|
10 | print " --keystore <keystore> \\" |
---|
11 | print " --role <role> --principal" |
---|
12 | print " loads the keystore and runs the query role <-?- principal" |
---|
13 | sys.exit(1) |
---|
14 | |
---|
15 | pp = pprint.PrettyPrinter(indent=4) |
---|
16 | |
---|
17 | keystore = '' |
---|
18 | role = '' |
---|
19 | principal = '' |
---|
20 | |
---|
21 | try: |
---|
22 | opts, args = getopt.getopt(sys.argv[1:], '', ['keystore=', 'role=', 'principal=']) |
---|
23 | except getopt.GetoptError, err: |
---|
24 | print str(err) |
---|
25 | sys.exit(1) |
---|
26 | |
---|
27 | for o, a in opts: |
---|
28 | if o == '--keystore': |
---|
29 | keystore = a |
---|
30 | elif o == '--role': |
---|
31 | role = a |
---|
32 | elif o == '--principal': |
---|
33 | principal = a |
---|
34 | else: |
---|
35 | assert False, "WAT" |
---|
36 | |
---|
37 | if keystore == '' or role == '' or principal == '': |
---|
38 | usage() |
---|
39 | |
---|
40 | # code begins here! sorry about that |
---|
41 | |
---|
42 | ctx = Context() |
---|
43 | ctx.load_directory(keystore) |
---|
44 | |
---|
45 | (success, credentials) = ctx.query(role, principal) |
---|
46 | |
---|
47 | if success: |
---|
48 | print "success" |
---|
49 | |
---|
50 | for credential in credentials: |
---|
51 | print "credential %s <- %s" % (credential.head().string(), credential.tail().string()) |
---|
52 | # pp.pprint(credential) |
---|
Note: See
TracBrowser
for help on using the repository browser.