1 from sfa.util.faults import *
2 from sfa.util.method import Method
3 from sfa.util.parameter import Parameter, Mixed
4 from sfa.trust.auth import Auth
5 from sfa.trust.credential import Credential
8 class get_trusted_certs(Method):
10 @param cred credential string specifying the rights of the caller
11 @return list of gid strings
14 interfaces = ['registry', 'aggregate', 'slicemgr']
17 Mixed(Parameter(str, "Credential string"),
18 Parameter(None, "Credential not specified"))
21 returns = Parameter(type([str]), "List of GID strings")
23 def call(self, cred = None):
24 # If cred is not specified just return the gid for this interface.
25 # This is true when when a peer is attempting to initiate federation
27 self.api.logger.debug("get_trusted_certs: %r"%cred)
30 for gid in self.api.auth.trusted_cert_list:
31 if gid.get_hrn() == self.api.config.SFA_INTERFACE_HRN:
32 gid_strings.append(gid.save_to_string(save_parents=True))
35 # authenticate the cred
36 self.api.auth.check(cred, 'gettrustedcerts')
37 gid_strings = [gid.save_to_string(save_parents=True) for \
38 gid in self.api.auth.trusted_cert_list]