1 # * require certificate as an argument
3 # * get pubkey from gid
4 # * if certifacate matches pubkey from gid, return gid, else raise exception
5 # if not peer.is_pubkey(gid.get_pubkey()):
6 # raise ConnectionKeyGIDMismatch(gid.get_subject())
8 from sfa.util.faults import *
9 from sfa.util.misc import *
10 from sfa.util.method import Method
11 from sfa.util.parameter import Parameter, Mixed
12 from sfa.trust.auth import Auth
13 from sfa.trust.gid import GID
14 from sfa.trust.certificate import Certificate
15 from sfa.util.genitable import GeniTable
17 class get_gids(Method):
19 Get a list of record information (hrn, gid and type) for
22 @param cred credential string
23 @param cert certificate string
27 interfaces = ['registry']
30 Parameter(str, "Certificate string"),
31 Mixed(Parameter(str, "Human readable name (hrn)"),
32 Parameter([str], "List of Human readable names (hrn)")),
33 Mixed(Parameter(str, "Request hash"),
34 Parameter(None, "Request hash not specified"))
37 returns = [Parameter(dict, "Dictionary of gids keyed on hrn")]
39 def call(self, cred, hrns, request_hash=None):
40 self.api.auth.authenticateCred(cred, [cred, hrns], request_hash)
41 self.api.auth.check(cred, 'getgids')
43 if not isinstance(hrns, list):
45 records = table.find({'hrn': hrns}, columns=['hrn','type','gid'])