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