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
7 class get_trusted_certs(Method):
9 @param cred credential string specifying the rights of the caller
10 @return list of gid strings
13 interfaces = ['registry', 'aggregate', 'slicemgr']
16 Mixed(Parameter(str, "Credential string"),
17 Parameter(None, "Credential not specified"))
20 returns = Parameter(type([str]), "List of GID strings")
22 def call(self, cred = None):
23 # If cred is not specified just return the gid for this interface.
24 # This is true when when a peer is attempting to initiate federation
26 sfalogging.logger.debug("get_trusted_certs: %r"%cred)
29 for gid in self.api.auth.trusted_cert_list:
30 if gid.get_hrn() == self.api.config.SFA_INTERFACE_HRN:
31 gid_strings.append(gid.save_to_string(save_parents=True))
34 # authenticate the cred
35 self.api.auth.check(cred, 'gettrustedcerts')
36 gid_strings = [gid.save_to_string(save_parents=True) for \
37 gid in self.api.auth.trusted_cert_list]