* tried to put some sense in the way things get logged, at least on server-side for now
[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.methods.GetSelfCredential import GetSelfCredential
12
13 class get_self_credential(GetSelfCredential):
14     """
15     Deprecated. Use GetSelfCredential instead.
16
17     Retrive a credential for an object
18     @param cert certificate string 
19     @param type type of object (user | slice | sa | ma | node)
20     @param hrn human readable name of object (hrn or urn)
21
22     @return the string representation of a credential object  
23     """
24
25     interfaces = ['registry']
26     
27     accepts = [
28         Parameter(str, "Human readable name (hrn or urn)"),
29         Parameter(str, "certificate"),
30         Mixed(Parameter(str, "Request hash"),
31               Parameter(None, "Request hash not specified"))
32         ]
33
34     returns = Parameter(str, "String representation of a credential object")
35
36     def call(self, cert, type, xrn, origin_hrn=None):
37         """
38         get_self_credential a degenerate version of get_credential used by a client
39         to get his initial credential when de doesnt have one. This is the same as
40         get_credetial(..., cred = None, ...)
41
42         The registry ensures that the client is the principal that is named by
43         (type, name) by comparing the public key in the record's  GID to the
44         private key used to encrypt the client side of the HTTPS connection. Thus
45         it is impossible for one principal to retrive another principal's
46         credential without having the appropriate private key.
47
48         @param type type of object (user | slice | sa | ma | node)
49         @param hrn human readable name of authority to list
50         @return string representation of a credential object
51         """
52         return GetSelfCredential.call(self, cert, xrn, type)