File: //lib64/python3.9/site-packages/ldap/__pycache__/sasl.cpython-39.opt-1.pyc
a
�.d � @ s~ d Z ddlmZ dZdZdZdZdZ dZ
d ZG d
d� d�ZG dd
� d
e�Z
G dd� de�ZG dd� de�ZG dd� de�ZdS )a�
sasl.py - support for SASL mechanism
See https://www.python-ldap.org/ for details.
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.
� )�__version__i@ i@ i@ i@ i@ i@ i@ c @ s e Zd ZdZdd� Zdd� ZdS )�sasla
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
overridden
c C s( |pi | _ t|t�s|�d�}|| _dS )a
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.
�utf-8N)�
cb_value_dict�
isinstance�bytes�encode�mech)�selfr r � r �//usr/lib64/python3.9/site-packages/ldap/sasl.py�__init__) s
z
sasl.__init__c C s* | j �||�pd}t|t�s&|�d�}|S )a�
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).
Unicode strings are always converted to bytes.
� r )r �get�_trace_level�_trace_file�reprr r r )r
Zcb_idZ challenge�promptZ defresultZ cb_resultr r r �callback5 s
z
sasl.callbackN)�__name__�
__module__�__qualname__�__doc__r
r r r r r r s r c @ s e Zd ZdZddd�ZdS )�cram_md5z:
This class handles SASL CRAM-MD5 authentication.
r c C s"