source: tests/python_tests/basic_id/id_ctxt.py @ ec550f7

abac0-leakabac0-meimei-idtvf-new-xml
Last change on this file since ec550f7 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: 1.1 KB
Line 
1#!/usr/bin/env python
2
3"""
4  to test when an id gets loaded into the session
5vs when it gets loaded into a context
6
7cmd:env keystore=`pwd` ./id_ctxt.py
8
9"""
10
11import os
12import ABAC
13
14def pSZ(CTXT,msg):
15   psz= CTXT.principal_count()
16   csz= CTXT.credential_count()
17   print "context [%s] %d principals, %d credentials" % (msg,psz,csz)
18
19ctxtA = ABAC.Context()
20ctxtB = ABAC.Context()
21
22ABAC.dump_debug_info("first")
23pSZ(ctxtA, "A")
24pSZ(ctxtB, "B")
25
26## creating and writing out using libabac ID
27id=ABAC.ID("Ella", 0)
28print "adding -> %s(good) to session" % id.id_name()
29id.id_write_cert("Ella_ID.pem")
30id.id_write_privkey("Ella_private.pem")
31
32ABAC.dump_debug_info("second")
33pSZ(ctxtA, "A")
34pSZ(ctxtB, "B")
35
36## load principal with id/key file pair
37## note, with this, we do not have handle on the keyid
38## to Ella but it will be in the db
39print "loading -> %s to ctxtA" % id.id_name()
40ctxtA.load_id_files("Ella_ID.pem","Ella_private.pem")
41
42print "loading -> Bob to ctxtB"
43ctxtB.load_id_files("Bob_ID.pem","Bob_private.pem")
44
45ABAC.dump_debug_info("third")
46pSZ(ctxtA, "A")
47pSZ(ctxtB, "B")
Note: See TracBrowser for help on using the repository browser.