Ignore:
Timestamp:
Jan 15, 2011 5:52:15 PM (14 years ago)
Author:
Ted Faber <faber@…>
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)
Message:

merge from current

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/emulab_access.py

    rac15159 r0a49bd7  
    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
     
    254255                    'Bad mapping (unbalanced parens or more than 1 comma)')
    255256
    256 
    257257    # RequestAccess support routines
    258258
     
    384384        self.state_lock.acquire()
    385385        self.allocation[aid] = { }
     386        self.allocation[aid]['auth'] = set()
    386387        try:
    387388            pname = ap['project']['name']['localname']
     
    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,
     
    511513        for k, v in svc_state.items():
    512514            self.allocation[aid][k] = v
     515        self.append_allocation_authorization(aid,
     516                set([(o, allocID) for o in owners]), state_attr='allocation')
    513517        self.write_state()
    514518        self.state_lock.release()
    515         # Give the owners the right to change this allocation
    516         for o in owners:
    517             self.auth.set_attribute(o, allocID)
    518         self.auth.save()
    519519        try:
    520520            f = open("%s/%s.pem" % (self.certdir, aid), "w")
     
    525525                    "Can't open %s/%s : %s" % (self.certdir, aid, e))
    526526        resp = self.build_access_response({ 'fedid': allocID } ,
    527                 ap, services)
     527                ap, services, proof)
    528528        return resp
    529529
     
    572572        self.log.debug("[access] deallocation requested for %s by %s" % \
    573573                (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:
    575577            self.log.debug("[access] deallocation denied for %s", aid)
    576578            raise service_error(service_error.access, "Access Denied")
     
    591593        if aid in self.allocation:
    592594            self.log.debug("Found allocation for %s" %aid)
     595            self.clear_allocation_authorization(aid, state_attr='allocation')
    593596            for k in self.allocation[aid]['keys']:
    594597                kk = "%s:%s" % k
     
    625628            self.log.debug("Removing %s" % cf)
    626629            os.remove(cf)
    627             return { 'allocID': req['allocID'] }
     630            return { 'allocID': req['allocID'], 'proof': proof.to_dict() }
    628631        else:
    629632            self.state_lock.release()
     
    9981001        return (ename, proj, user, pubkey_base, secretkey_base, alloc_log)
    9991002
    1000     def finalize_experiment(self, starter, topo, aid, alloc_id):
     1003    def finalize_experiment(self, starter, topo, aid, alloc_id, proof):
    10011004        """
    10021005        Store key bits of experiment state in the global repository, including
     
    10231026                    'topdldescription': topo.clone().to_dict()
    10241027                    },
    1025                 'embedding': embedding
     1028                'embedding': embedding,
     1029                'proof': proof.to_dict(),
    10261030                }
    10271031        retval = copy.copy(self.allocation[aid]['started'])
     
    10471051        aid = "%s" % auth_attr
    10481052        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:
    10501057            raise service_error(service_error.access, "Access denied")
    10511058        else:
     
    11131120
    11141121        if rv:
    1115             return self.finalize_experiment(starter, topo, aid, req['allocID'])
     1122            return self.finalize_experiment(starter, topo, aid, req['allocID'],
     1123                    proof)
    11161124        elif err:
    11171125            raise service_error(service_error.federant,
     
    11291137        aid = "%s" % auth_attr
    11301138        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:
    11321143            raise service_error(service_error.access, "Access denied")
    11331144
     
    11581169                debug=self.create_debug, boss=self.boss, cert=self.xmlrpc_cert)
    11591170        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.