Skip to content

Commit 2f742c3

Browse files
committed
Document low-level credential store extensions
This commit documents both the credential store extensions and RFC 5588. Part of #9
1 parent 570a6da commit 2f742c3

File tree

2 files changed

+110
-0
lines changed

2 files changed

+110
-0
lines changed

gssapi/raw/ext_cred_store.pyx

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,34 @@ cdef void c_free_key_value_set(gss_key_value_set_desc *kvset):
9696
# but that's not clear from the wiki page
9797
def acquire_cred_from(dict store, Name name, ttl=None,
9898
mechs=None, cred_usage='both'):
99+
"""Acquire credentials from the given store
100+
101+
This method acquires credentials from the store specified by the
102+
given credential store information.
103+
104+
The credential store information is a dictionary containing
105+
mechanisms-specific keys and values pointing to a credential store
106+
or stores.
107+
108+
Args:
109+
store (dict): the credential store information pointing to the
110+
credential store from which to acquire the credentials
111+
name (Name): the name associated with the credentials,
112+
or None for the default name
113+
ttl (int): the desired lifetime of the credentials, or None
114+
for indefinite
115+
mechs (list): the desired mechanisms to be used with these
116+
credentials, or None for the default set
117+
cred_usage (str): the usage for these credentials -- either 'both',
118+
'initiate', or 'accept'
119+
120+
Returns:
121+
AcquireCredResult: the acquired credentials and information about
122+
them
123+
124+
Raises:
125+
GSSError
126+
"""
99127

100128
cdef gss_OID_set desired_mechs
101129
if mechs is not None:
@@ -156,6 +184,38 @@ def add_cred_from(dict store, Creds input_creds,
156184
Name name not None, OID mech not None,
157185
cred_usage='both', initiator_ttl=None,
158186
acceptor_ttl=None):
187+
"""Acquire credentials to add to the current set from the given store
188+
189+
This method works like :func:`acquire_cred_from`, except that it
190+
adds the acquired credentials for a single mechanism to a copy of
191+
the current set, instead of creating a new set for multiple mechanisms.
192+
Unlike :meth:`acquire`, you cannot pass None desired name or
193+
mechanism.
194+
195+
The credential store information is a dictionary containing
196+
mechanisms-specific keys and values pointing to a credential store
197+
or stores.
198+
199+
Args:
200+
store (dict): the store into which to store the credentials,
201+
or None for the default store.
202+
name (Name): the name associated with the credentials
203+
mech (OID): the desired mechanism to be used with these
204+
credentials
205+
cred_usage (str): the usage for these credentials -- either 'both',
206+
'initiate', or 'accept'
207+
initiator_ttl): the desired initiate lifetime of the
208+
credentials, or None for indefinite
209+
acceptor_ttl (int): the desired accept lifetime of the
210+
credentials, or None for indefinite
211+
212+
Returns:
213+
AcquireCredResult: the new credentials set and information about
214+
it
215+
216+
Raises:
217+
GSSError
218+
"""
159219

160220
cdef OM_uint32 input_initiator_ttl = c_py_ttl_to_c(initiator_ttl)
161221
cdef OM_uint32 input_acceptor_ttl = c_py_ttl_to_c(acceptor_ttl)
@@ -214,6 +274,35 @@ def add_cred_from(dict store, Creds input_creds,
214274
def store_cred_into(dict store, Creds creds not None,
215275
cred_usage='both', OID mech=None, bint overwrite=False,
216276
bint set_default=False):
277+
"""Store credentials to the given store
278+
279+
This method stores the given credentials into the store specified
280+
by the given store information. They may then be retrieved later using
281+
:func:`import_cred_from`.
282+
283+
The credential store information is a dictionary containing
284+
mechanisms-specific keys and values pointing to a credential store
285+
or stores.
286+
287+
Args:
288+
store (dict): the store into which to store the credentials,
289+
or None for the default store.
290+
creds (Creds): the credentials to store
291+
cred_usage (str): the usage to store the credentials with -- either
292+
'both', 'initiate', or 'accept'
293+
mech (OID): the mechansim to associate with the stored credentials
294+
overwrite (bool): whether or not to overwrite existing credentials
295+
stored with the same name, etc
296+
set_default (bool): whether or not to set these credentials as
297+
the default credentials for the given store.
298+
299+
Returns:
300+
StoreCredResult: the results of the credential storing operation
301+
302+
Raises:
303+
GSSError
304+
"""
305+
217306
cdef gss_OID desired_mech
218307
if mech is not None:
219308
desired_mech = &mech.raw_oid

gssapi/raw/ext_rfc5588.pyx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,27 @@ cdef extern from "gssapi.h":
2424

2525
def store_cred(Creds creds not None, cred_usage='both', OID mech=None,
2626
bint overwrite=False, bint set_default=False):
27+
"""Store credentials to the default store
28+
29+
This method stores the given credentials into the default store.
30+
They may then be retrieved later using :func:`acquire_cred`.
31+
32+
Args:
33+
creds (Creds): the credentials to store
34+
cred_usage (str): the usage to store the credentials with -- either
35+
'both', 'initiate', or 'accept'
36+
mech (OID): the mechansim to associate with the stored credentials
37+
overwrite (bool): whether or not to overwrite existing credentials
38+
stored with the same name, etc
39+
set_default (bool): whether or not to set these credentials as
40+
the default credentials for the given store.
41+
42+
Returns:
43+
StoreCredResult: the results of the credential storing operation
44+
45+
Raises:
46+
GSSError
47+
"""
2748
cdef gss_OID desired_mech
2849
if mech is not None:
2950
desired_mech = &mech.raw_oid

0 commit comments

Comments
 (0)