Ńň
/čęJc @ sŻ d Z d d k l Z d Z d Z d Z d Z d Z d Z d Z d
d d YZ
d e
f d
YZ d e
f d YZ d e
f d YZ
d e
f d YZ d S( s.
sasl.py - support for SASL mechanism
See http://www.python-ldap.org/ for details.
\$Id: sasl.py,v 1.15 2009/07/26 11:09:58 stroeder Exp $
Description:
The ldap.sasl module provides SASL authentication classes.
Each class provides support for one SASL mechanism. This is done by
implementing a callback() - method, which will be called by the
LDAPObject's sasl_bind_s() method
Implementing support for new sasl mechanism is very easy --- see
the examples of digest_md5 and gssapi.
Compability:
- Tested with Python 2.0+ but should work with Python 1.5.x
i˙˙˙˙( t __version__i@ i@ i@ i@ i@ i@ i@ t saslc B s e Z d Z d Z d Z RS( s This class handles SASL interactions for authentication.
If an instance of this class is passed to ldap's sasl_bind_s()
method, the library will call its callback() method. For
specific SASL authentication mechanisms, this method can be
overriddenc C s | p h | _ | | _ d S( sň The (generic) base class takes a cb_value_dictionary of
question-answer pairs. Questions are specified by the respective
SASL callback id's. The mech argument is a string that specifies
the SASL mechaninsm to be uesd.N( t
cb_value_dictt mech( t selfR R ( ( s/ /usr/lib64/python2.6/site-packages/ldap/sasl.pyt __init__+ s c C s | i i | | p d } | S( s The callback method will be called by the sasl_bind_s()
method several times. Each time it will provide the id, which
tells us what kind of information is requested (the CB_ ...
constants above). The challenge might be a short (english) text
or some binary string, from which the return value is calculated.
The prompt argument is always a human-readable description string;
The defresult is a default value provided by the sasl library
Currently, we do not use the challenge and prompt information, and
return only information which is stored in the self.cb_value_dict
cb_value_dictionary. Note that the current callback interface is not very
useful for writing generic sasl GUIs, which would need to know all
the questions to ask, before the answers are returned to the sasl
lib (in contrast to one question at a time).t ( R t get( R t cb_idt challenget promptt defresultt cb_result( ( s/ /usr/lib64/python2.6/site-packages/ldap/sasl.pyt callback3 s ( t __name__t
__module__t __doc__R R
( ( ( s/ /usr/lib64/python2.6/site-packages/ldap/sasl.pyR $ s t cram_md5c B s e Z d Z d d Z RS( s0 This class handles SASL CRAM-MD5 authentication.R c C s2 h | t 6| t 6| t 6} t i | | d d S( Ns CRAM-MD5( t CB_AUTHNAMEt CB_PASSt CB_USERR R ( R t authc_idt passwordt authz_idt auth_dict( ( s/ /usr/lib64/python2.6/site-packages/ldap/sasl.pyR Q s
( R R R R ( ( ( s/ /usr/lib64/python2.6/site-packages/ldap/sasl.pyR N s t
digest_md5c B s e Z d Z d d Z RS( s2 This class handles SASL DIGEST-MD5 authentication.R c C s2 h | t 6| t 6| t 6} t i | | d d S( Ns
DIGEST-MD5( R R R R R ( R R R R R ( ( s/ /usr/lib64/python2.6/site-packages/ldap/sasl.pyR Z s
( R R R R ( ( ( s/ /usr/lib64/python2.6/site-packages/ldap/sasl.pyR W s t gssapic B s e Z d Z d d Z RS( sD This class handles SASL GSSAPI (i.e. Kerberos V)
authentication.R c C s t i | h | t 6d d S( Nt GSSAPI( R R R ( R R ( ( s/ /usr/lib64/python2.6/site-packages/ldap/sasl.pyR d s ( R R R R ( ( ( s/ /usr/lib64/python2.6/site-packages/ldap/sasl.pyR ` s t externalc B s e Z d Z d d Z RS( sS This class handles SASL EXTERNAL authentication
(i.e. X.509 client certificate)R c C s t i | h | t 6d d S( Nt EXTERNAL( R R R ( R R ( ( s/ /usr/lib64/python2.6/site-packages/ldap/sasl.pyR l s ( R R R R ( ( ( s/ /usr/lib64/python2.6/site-packages/ldap/sasl.pyR h s N( ( R t ldapR R R t CB_LANGUAGER t
CB_ECHOPROMPTt CB_NOECHOPROMPTt CB_GETREALMR R R R R ( ( ( s/ /usr/lib64/python2.6/site-packages/ldap/sasl.pyt