source: tests/example_scripts/wiki/ctxtQuery4_setup.py @ bceef20

abac0-leakabac0-mei
Last change on this file since bceef20 was bceef20, checked in by Mei <mei@…>, 11 years ago

1) add the new tests

  • Property mode set to 100755
File size: 714 bytes
Line 
1#!/usr/bin/env python
2"""
3ctxtQuery4_setup.py
4 
5creating a abac attribute credential
6   acme.experiment_create <- acme
7
8"""
9import os
10import sys
11import ABAC
12
13ctx = ABAC.Context()
14
15## note id did not get loaded into ctx and so keyid map is not generated
16## hence no mnemonic table
17acme = ABAC.ID("Acme", 24 * 3600 * 365 * 20)
18attr = ABAC.Attribute(acme, "experiment_create", 24 * 3600 * 365 * 20)
19attr.principal(acme.keyid())
20attr.bake(ctx)
21attr.write_file("abac_cred.xml")
22
23coyote = ABAC.ID("Coyote", 24 * 3600 * 365 * 20)
24ctx.load_id_chunk(coyote.cert_chunk())
25attr2 = ABAC.Attribute(coyote, "lives_dangerously", 24 * 3600 * 365 * 20)
26attr2.principal(acme.keyid())
27attr2.bake(ctx)
28attr2.write_file("coyote.xml")
Note: See TracBrowser for help on using the repository browser.