Changeset 0a49bd7 for fedd/federation/emulab_access.py
- Timestamp:
- Jan 15, 2011 5:52:15 PM (14 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master
- Children:
- aaf7f41
- Parents:
- ac15159 (diff), 944b746 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - git-author:
- Ted Faber <faber@…> (01/15/11 17:51:40)
- git-committer:
- Ted Faber <faber@…> (01/15/11 17:52:15)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/emulab_access.py
rac15159 r0a49bd7 24 24 from service_error import service_error 25 25 from remote_service import xmlrpc_handler, soap_handler, service_caller 26 from proof import proof as access_proof 26 27 27 28 import httplib … … 254 255 'Bad mapping (unbalanced parens or more than 1 comma)') 255 256 256 257 257 # RequestAccess support routines 258 258 … … 384 384 self.state_lock.acquire() 385 385 self.allocation[aid] = { } 386 self.allocation[aid]['auth'] = set() 386 387 try: 387 388 pname = ap['project']['name']['localname'] … … 480 481 481 482 if self.auth_type == "legacy": 482 found, dyn, owners = self.legacy_lookup_access(req, fid) 483 found, dyn, owners= self.legacy_lookup_access(req, fid) 484 proof = access_proof("me", fid, "create") 483 485 elif self.auth_type == 'abac': 484 found, dyn, owners = self.lookup_access(req, fid, filter=pf)486 found, dyn, owners, proof = self.lookup_access(req, fid, filter=pf) 485 487 else: 486 488 raise service_error(service_error.internal, … … 511 513 for k, v in svc_state.items(): 512 514 self.allocation[aid][k] = v 515 self.append_allocation_authorization(aid, 516 set([(o, allocID) for o in owners]), state_attr='allocation') 513 517 self.write_state() 514 518 self.state_lock.release() 515 # Give the owners the right to change this allocation516 for o in owners:517 self.auth.set_attribute(o, allocID)518 self.auth.save()519 519 try: 520 520 f = open("%s/%s.pem" % (self.certdir, aid), "w") … … 525 525 "Can't open %s/%s : %s" % (self.certdir, aid, e)) 526 526 resp = self.build_access_response({ 'fedid': allocID } , 527 ap, services )527 ap, services, proof) 528 528 return resp 529 529 … … 572 572 self.log.debug("[access] deallocation requested for %s by %s" % \ 573 573 (aid, fid)) 574 if not self.auth.check_attribute(fid, auth_attr): 574 access_ok, proof = self.auth.check_attribute(fid, auth_attr, 575 with_proof=True) 576 if not access_ok: 575 577 self.log.debug("[access] deallocation denied for %s", aid) 576 578 raise service_error(service_error.access, "Access Denied") … … 591 593 if aid in self.allocation: 592 594 self.log.debug("Found allocation for %s" %aid) 595 self.clear_allocation_authorization(aid, state_attr='allocation') 593 596 for k in self.allocation[aid]['keys']: 594 597 kk = "%s:%s" % k … … 625 628 self.log.debug("Removing %s" % cf) 626 629 os.remove(cf) 627 return { 'allocID': req['allocID'] }630 return { 'allocID': req['allocID'], 'proof': proof.to_dict() } 628 631 else: 629 632 self.state_lock.release() … … 998 1001 return (ename, proj, user, pubkey_base, secretkey_base, alloc_log) 999 1002 1000 def finalize_experiment(self, starter, topo, aid, alloc_id ):1003 def finalize_experiment(self, starter, topo, aid, alloc_id, proof): 1001 1004 """ 1002 1005 Store key bits of experiment state in the global repository, including … … 1023 1026 'topdldescription': topo.clone().to_dict() 1024 1027 }, 1025 'embedding': embedding 1028 'embedding': embedding, 1029 'proof': proof.to_dict(), 1026 1030 } 1027 1031 retval = copy.copy(self.allocation[aid]['started']) … … 1047 1051 aid = "%s" % auth_attr 1048 1052 attrs = req.get('fedAttr', []) 1049 if not self.auth.check_attribute(fid, auth_attr): 1053 1054 access_ok, proof = self.auth.check_attribute(fid, auth_attr, 1055 with_proof=True) 1056 if not access_ok: 1050 1057 raise service_error(service_error.access, "Access denied") 1051 1058 else: … … 1113 1120 1114 1121 if rv: 1115 return self.finalize_experiment(starter, topo, aid, req['allocID']) 1122 return self.finalize_experiment(starter, topo, aid, req['allocID'], 1123 proof) 1116 1124 elif err: 1117 1125 raise service_error(service_error.federant, … … 1129 1137 aid = "%s" % auth_attr 1130 1138 attrs = req.get('fedAttr', []) 1131 if not self.auth.check_attribute(fid, auth_attr): 1139 1140 access_ok, proof = self.auth.check_attribute(fid, auth_attr, 1141 with_proof=True) 1142 if not access_ok: 1132 1143 raise service_error(service_error.access, "Access denied") 1133 1144 … … 1158 1169 debug=self.create_debug, boss=self.boss, cert=self.xmlrpc_cert) 1159 1170 stopper(self, user, proj, ename) 1160 return { 'allocID': req['allocID'] }1171 return { 'allocID': req['allocID'], 'proof': proof.to_dict() }
Note: See TracChangeset
for help on using the changeset viewer.