1 from sfa.util.method import Method
2 from sfa.util.sfalogging import logger
4 from sfa.trust.auth import Auth
5 from sfa.trust.credential import Credential
7 from sfa.storage.parameter import Parameter, Mixed
10 class get_trusted_certs(Method):
12 @param cred credential string specifying the rights of the caller
13 @return list of gid strings
16 interfaces = ['registry', 'aggregate', 'slicemgr']
19 Mixed(Parameter(str, "Credential string"),
20 Parameter(None, "Credential not specified"))
23 returns = Parameter(type([str]), "List of GID strings")
25 def call(self, cred=None):
26 # If cred is not specified just return the gid for this interface.
27 # This is true when when a peer is attempting to initiate federation
29 logger.debug("get_trusted_certs: %r" % cred)
32 for gid in self.api.auth.trusted_cert_list:
33 if gid.get_hrn() == self.api.config.SFA_INTERFACE_HRN:
34 gid_strings.append(gid.save_to_string(save_parents=True))
37 # authenticate the cred
38 self.api.auth.check(cred, 'gettrustedcerts')
39 gid_strings = [gid.save_to_string(save_parents=True) for
40 gid in self.api.auth.trusted_cert_list]