a little nicer wrt pep8
[sfa.git] / docs / pythondoc-credential.html
1 <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
2 <html>
3 <head>
4 <meta http-equiv='Content-Type' content='text/html; charset=us-ascii' />
5 <title>The credential Module</title>
6 </head>
7 <body>
8 <h1>The credential Module</h1>
9 <p>Implements Geni Credentials
10
11 Credentials are layered on top of certificates, and are essentially a
12 certificate that stores a tuple of parameters.</p>
13 <dl>
14 <dt><b>Credential(create=False, subject=None, string=None, filename=None)</b> (class) [<a href='#credential.Credential-class'>#</a>]</dt>
15 <dd>
16 <p>Credential is a tuple:
17     (GIDCaller, GIDObject, LifeTime, Privileges, Delegate)
18
19 These fields are encoded using xmlrpc into the subjectAltName field of the
20 x509 certificate.</p>
21 <p>For more information about this class, see <a href='#credential.Credential-class'><i>The Credential Class</i></a>.</p>
22 </dd>
23 </dl>
24 <h2><a id='credential.Credential-class' name='credential.Credential-class'>The Credential Class</a></h2>
25 <dl>
26 <dt><b>Credential(create=False, subject=None, string=None, filename=None)</b> (class) [<a href='#credential.Credential-class'>#</a>]</dt>
27 <dd>
28 <p>Credential is a tuple:
29     (GIDCaller, GIDObject, LifeTime, Privileges, Delegate)
30
31 These fields are encoded using xmlrpc into the subjectAltName field of the
32 x509 certificate. Note: Call encode() once the fields have been filled in
33 to perform this encoding.</p>
34 </dd>
35 <dt><a id='credential.Credential.__init__-method' name='credential.Credential.__init__-method'><b>__init__(create=False, subject=None, string=None, filename=None)</b></a> [<a href='#credential.Credential.__init__-method'>#</a>]</dt>
36 <dd>
37 <p>Create a Credential object</p>
38 <dl>
39 <dt><i>create</i></dt>
40 <dd>
41 If true, create a blank x509 certificate</dd>
42 <dt><i>subject</i></dt>
43 <dd>
44 If subject!=None, create an x509 cert with the subject name</dd>
45 <dt><i>string</i></dt>
46 <dd>
47 If string!=None, load the credential from the string</dd>
48 <dt><i>filename</i></dt>
49 <dd>
50 If filename!=None, load the credential from the file</dd>
51 </dl><br />
52 </dd>
53 <dt><a id='credential.Credential.can_perform-method' name='credential.Credential.can_perform-method'><b>can_perform(op_name)</b></a> [<a href='#credential.Credential.can_perform-method'>#</a>]</dt>
54 <dd>
55 <p>determine whether the credential allows a particular operation to be
56 performed</p>
57 <dl>
58 <dt><i>op_name</i></dt>
59 <dd>
60 string specifying name of operation (&quot;lookup&quot;, &quot;update&quot;, etc)</dd>
61 </dl><br />
62 </dd>
63 <dt><a id='credential.Credential.decode-method' name='credential.Credential.decode-method'><b>decode()</b></a> [<a href='#credential.Credential.decode-method'>#</a>]</dt>
64 <dd>
65 <p>Retrieve the attributes of the credential from the alt-subject-name field
66 of the X509 certificate. This is automatically done by the various
67 get_* methods of this class and should not need to be called explicitly.</p>
68 </dd>
69 <dt><a id='credential.Credential.dump-method' name='credential.Credential.dump-method'><b>dump(dump_parents=False)</b></a> [<a href='#credential.Credential.dump-method'>#</a>]</dt>
70 <dd>
71 <p>Dump the contents of a credential to stdout in human-readable format</p>
72 <dl>
73 <dt><i>dump_parents</i></dt>
74 <dd>
75 If true, also dump the parent certificates</dd>
76 </dl><br />
77 </dd>
78 <dt><a id='credential.Credential.encode-method' name='credential.Credential.encode-method'><b>encode()</b></a> [<a href='#credential.Credential.encode-method'>#</a>]</dt>
79 <dd>
80 <p>Encode the attributes of the credential into a string and store that
81 string in the alt-subject-name field of the X509 object. This should be
82 done immediately before signing the credential.</p>
83 </dd>
84 <dt><a id='credential.Credential.get_delegate-method' name='credential.Credential.get_delegate-method'><b>get_delegate()</b></a> [<a href='#credential.Credential.get_delegate-method'>#</a>]</dt>
85 <dd>
86 <p>get the delegate bit</p>
87 </dd>
88 <dt><a id='credential.Credential.get_gid_caller-method' name='credential.Credential.get_gid_caller-method'><b>get_gid_caller()</b></a> [<a href='#credential.Credential.get_gid_caller-method'>#</a>]</dt>
89 <dd>
90 <p>get the GID of the object</p>
91 </dd>
92 <dt><a id='credential.Credential.get_gid_object-method' name='credential.Credential.get_gid_object-method'><b>get_gid_object()</b></a> [<a href='#credential.Credential.get_gid_object-method'>#</a>]</dt>
93 <dd>
94 <p>get the GID of the object</p>
95 </dd>
96 <dt><a id='credential.Credential.get_lifetime-method' name='credential.Credential.get_lifetime-method'><b>get_lifetime()</b></a> [<a href='#credential.Credential.get_lifetime-method'>#</a>]</dt>
97 <dd>
98 <p>get the lifetime of the credential</p>
99 </dd>
100 <dt><a id='credential.Credential.get_privileges-method' name='credential.Credential.get_privileges-method'><b>get_privileges()</b></a> [<a href='#credential.Credential.get_privileges-method'>#</a>]</dt>
101 <dd>
102 <p>return the privileges as a RightList object</p>
103 </dd>
104 <dt><a id='credential.Credential.set_delegate-method' name='credential.Credential.set_delegate-method'><b>set_delegate(delegate)</b></a> [<a href='#credential.Credential.set_delegate-method'>#</a>]</dt>
105 <dd>
106 <p>set the delegate bit</p>
107 <dl>
108 <dt><i>delegate</i></dt>
109 <dd>
110 boolean (True or False)</dd>
111 </dl><br />
112 </dd>
113 <dt><a id='credential.Credential.set_gid_caller-method' name='credential.Credential.set_gid_caller-method'><b>set_gid_caller(gid)</b></a> [<a href='#credential.Credential.set_gid_caller-method'>#</a>]</dt>
114 <dd>
115 <p>set the GID of the caller</p>
116 <dl>
117 <dt><i>gid</i></dt>
118 <dd>
119 GID object of the caller</dd>
120 </dl><br />
121 </dd>
122 <dt><a id='credential.Credential.set_gid_object-method' name='credential.Credential.set_gid_object-method'><b>set_gid_object(gid)</b></a> [<a href='#credential.Credential.set_gid_object-method'>#</a>]</dt>
123 <dd>
124 <p>set the GID of the object</p>
125 <dl>
126 <dt><i>gid</i></dt>
127 <dd>
128 GID object of the object</dd>
129 </dl><br />
130 </dd>
131 <dt><a id='credential.Credential.set_lifetime-method' name='credential.Credential.set_lifetime-method'><b>set_lifetime(lifeTime)</b></a> [<a href='#credential.Credential.set_lifetime-method'>#</a>]</dt>
132 <dd>
133 <p>set the lifetime of this credential</p>
134 <dl>
135 <dt><i>lifetime</i></dt>
136 <dd>
137 lifetime of credential</dd>
138 </dl><br />
139 </dd>
140 <dt><a id='credential.Credential.set_privileges-method' name='credential.Credential.set_privileges-method'><b>set_privileges(privs)</b></a> [<a href='#credential.Credential.set_privileges-method'>#</a>]</dt>
141 <dd>
142 <p>set the privileges</p>
143 <dl>
144 <dt><i>privs</i></dt>
145 <dd>
146 either a comma-separated list of privileges of a RightList object</dd>
147 </dl><br />
148 </dd>
149 <dt><a id='credential.Credential.verify_chain-method' name='credential.Credential.verify_chain-method'><b>verify_chain(trusted_certs=None)</b></a> [<a href='#credential.Credential.verify_chain-method'>#</a>]</dt>
150 <dd>
151 <p>Verify that a chain of credentials is valid (see cert.py:verify). In
152 addition to the checks for ordinary certificates, verification also
153 ensures that the delegate bit was set by each parent in the chain. If
154 a delegate bit was not set, then an exception is thrown.
155
156 Each credential must be a subset of the rights of the parent.</p>
157 </dd>
158 </dl>
159 </body></html>