30
30
31
31
32
32
class sasl :
33
- """This class handles SASL interactions for authentication.
33
+ """
34
+ This class handles SASL interactions for authentication.
34
35
If an instance of this class is passed to ldap's sasl_bind_s()
35
36
method, the library will call its callback() method. For
36
37
specific SASL authentication mechanisms, this method can be
37
- overridden"""
38
+ overridden
39
+ """
38
40
39
41
def __init__ (self , cb_value_dict , mech ):
40
- """ The (generic) base class takes a cb_value_dictionary of
42
+ """
43
+ The (generic) base class takes a cb_value_dictionary of
41
44
question-answer pairs. Questions are specified by the respective
42
45
SASL callback id's. The mech argument is a string that specifies
43
- the SASL mechaninsm to be uesd."""
46
+ the SASL mechaninsm to be uesd.
47
+ """
44
48
self .cb_value_dict = cb_value_dict or {}
45
49
self .mech = mech
46
50
47
51
def callback (self , cb_id , challenge , prompt , defresult ):
48
- """ The callback method will be called by the sasl_bind_s()
52
+ """
53
+ The callback method will be called by the sasl_bind_s()
49
54
method several times. Each time it will provide the id, which
50
55
tells us what kind of information is requested (the CB_ ...
51
56
constants above). The challenge might be a short (english) text
@@ -58,7 +63,8 @@ def callback(self, cb_id, challenge, prompt, defresult):
58
63
cb_value_dictionary. Note that the current callback interface is not very
59
64
useful for writing generic sasl GUIs, which would need to know all
60
65
the questions to ask, before the answers are returned to the sasl
61
- lib (in contrast to one question at a time)."""
66
+ lib (in contrast to one question at a time).
67
+ """
62
68
63
69
# The following print command might be useful for debugging
64
70
# new sasl mechanisms. So it is left here
@@ -76,7 +82,9 @@ def callback(self, cb_id, challenge, prompt, defresult):
76
82
77
83
78
84
class cram_md5 (sasl ):
79
- """This class handles SASL CRAM-MD5 authentication."""
85
+ """
86
+ This class handles SASL CRAM-MD5 authentication.
87
+ """
80
88
81
89
def __init__ (self , authc_id , password , authz_id = "" ):
82
90
auth_dict = {
@@ -88,7 +96,9 @@ def __init__(self, authc_id, password, authz_id=""):
88
96
89
97
90
98
class digest_md5 (sasl ):
91
- """This class handles SASL DIGEST-MD5 authentication."""
99
+ """
100
+ This class handles SASL DIGEST-MD5 authentication.
101
+ """
92
102
93
103
def __init__ (self , authc_id , password , authz_id = "" ):
94
104
auth_dict = {
@@ -100,16 +110,19 @@ def __init__(self, authc_id, password, authz_id=""):
100
110
101
111
102
112
class gssapi (sasl ):
103
- """This class handles SASL GSSAPI (i.e. Kerberos V)
104
- authentication."""
113
+ """
114
+ This class handles SASL GSSAPI (i.e. Kerberos V) authentication.
115
+ """
105
116
106
117
def __init__ (self , authz_id = "" ):
107
118
sasl .__init__ (self , {CB_USER : authz_id }, "GSSAPI" )
108
119
109
120
110
121
class external (sasl ):
111
- """This class handles SASL EXTERNAL authentication
112
- (i.e. X.509 client certificate)"""
122
+ """
123
+ This class handles SASL EXTERNAL authentication
124
+ (i.e. X.509 client certificate)
125
+ """
113
126
114
127
def __init__ (self , authz_id = "" ):
115
128
sasl .__init__ (self , {CB_USER : authz_id }, "EXTERNAL" )
0 commit comments