3bdaecc799c004ceacb046eb34961ef336eaca10
[sfa.git] / sfa / methods / get_self_credential.py
1 ### $Id: get_credential.py 15321 2009-10-15 05:01:21Z tmack $
2 ### $URL: https://svn.planet-lab.org/svn/sfa/trunk/sfa/methods/get_credential.py $
3
4 from sfa.trust.credential import *
5 from sfa.trust.rights import *
6 from sfa.util.faults import *
7 from sfa.util.namespace import *
8 from sfa.util.method import Method
9 from sfa.util.parameter import Parameter, Mixed
10 from sfa.util.record import SfaRecord
11 from sfa.util.debug import log
12 from sfa.methods.GetSelfCredential import GetSelfCredential
13
14 class get_self_credential(GetSelfCredential):
15     """
16     Deprecated. Use GetSelfCredential instead.
17
18     Retrive a credential for an object
19     @param cert certificate string 
20     @param type type of object (user | slice | sa | ma | node)
21     @param hrn human readable name of object (hrn or urn)
22
23     @return the string representation of a credential object  
24     """
25
26     interfaces = ['registry']
27     
28     accepts = [
29         Parameter(str, "Human readable name (hrn or urn)"),
30         Parameter(str, "certificate"),
31         Mixed(Parameter(str, "Request hash"),
32               Parameter(None, "Request hash not specified"))
33         ]
34
35     returns = Parameter(str, "String representation of a credential object")
36
37     def call(self, cert, type, xrn, origin_hrn=None):
38         """
39         get_self_credential a degenerate version of get_credential used by a client
40         to get his initial credential when de doesnt have one. This is the same as
41         get_credetial(..., cred = None, ...)
42
43         The registry ensures that the client is the principal that is named by
44         (type, name) by comparing the public key in the record's  GID to the
45         private key used to encrypt the client side of the HTTPS connection. Thus
46         it is impossible for one principal to retrive another principal's
47         credential without having the appropriate private key.
48
49         @param type type of object (user | slice | sa | ma | node)
50         @param hrn human readable name of authority to list
51         @return string representation of a credential object
52         """
53         return GetSelfCredential.call(self, cert, xrn, type)