Ignore:
Timestamp:
Dec 14, 2010 6:58:28 PM (13 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master
Children:
c092b7f
Parents:
2627eb3
Message:

Move proofs around. Lots of changes, including fault handling.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/emulab_access.py

    r2627eb3 re83f2f2  
    2424from service_error import service_error
    2525from remote_service import xmlrpc_handler, soap_handler, service_caller
     26from proof import proof as access_proof
    2627
    2728import httplib
     
    480481
    481482        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")
    483485        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)
    485487        else:
    486488            raise service_error(service_error.internal,
     
    523525                    "Can't open %s/%s : %s" % (self.certdir, aid, e))
    524526        resp = self.build_access_response({ 'fedid': allocID } ,
    525                 ap, services)
     527                ap, services, proof)
    526528        return resp
    527529
     
    570572        self.log.debug("[access] deallocation requested for %s by %s" % \
    571573                (aid, fid))
    572         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:
    573577            self.log.debug("[access] deallocation denied for %s", aid)
    574578            raise service_error(service_error.access, "Access Denied")
     
    624628            self.log.debug("Removing %s" % cf)
    625629            os.remove(cf)
    626             return { 'allocID': req['allocID'] }
     630            return { 'allocID': req['allocID'], 'proof': proof.to_dict() }
    627631        else:
    628632            self.state_lock.release()
     
    9971001        return (ename, proj, user, pubkey_base, secretkey_base, alloc_log)
    9981002
    999     def finalize_experiment(self, starter, topo, aid, alloc_id):
     1003    def finalize_experiment(self, starter, topo, aid, alloc_id, proof):
    10001004        """
    10011005        Store key bits of experiment state in the global repository, including
     
    10221026                    'topdldescription': topo.clone().to_dict()
    10231027                    },
    1024                 'embedding': embedding
     1028                'embedding': embedding,
     1029                'proof': proof.to_dict(),
    10251030                }
    10261031        retval = copy.copy(self.allocation[aid]['started'])
     
    10461051        aid = "%s" % auth_attr
    10471052        attrs = req.get('fedAttr', [])
    1048         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:
    10491057            raise service_error(service_error.access, "Access denied")
    10501058        else:
     
    11121120
    11131121        if rv:
    1114             return self.finalize_experiment(starter, topo, aid, req['allocID'])
     1122            return self.finalize_experiment(starter, topo, aid, req['allocID'],
     1123                    proof)
    11151124        elif err:
    11161125            raise service_error(service_error.federant,
     
    11281137        aid = "%s" % auth_attr
    11291138        attrs = req.get('fedAttr', [])
    1130         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:
    11311143            raise service_error(service_error.access, "Access denied")
    11321144
     
    11571169                debug=self.create_debug, boss=self.boss, cert=self.xmlrpc_cert)
    11581170        stopper(self, user, proj, ename)
    1159         return { 'allocID': req['allocID'] }
     1171        return { 'allocID': req['allocID'], 'proof': proof.to_dict() }
Note: See TracChangeset for help on using the changeset viewer.