o
    1Éli&  ã                   @   sN   d Z ddlZddlmZ e e¡ZG dd„ deƒZG dd„ deƒZ	ee	gZ
dS )	aP  The credentials classes are used to encapsulate all authentication
information for the :class:`~pika.connection.ConnectionParameters` class.

The :class:`~pika.credentials.PlainCredentials` class returns the properly
formatted username and password to the :class:`~pika.connection.Connection`.

To authenticate with Pika, create a :class:`~pika.credentials.PlainCredentials`
object passing in the username and password and pass it as the credentials
argument value to the :class:`~pika.connection.ConnectionParameters` object.

If you are using :class:`~pika.connection.URLParameters` you do not need a
credentials object, one will automatically be created for you.

If you are looking to implement SSL certificate style authentication, you would
extend the :class:`~pika.credentials.ExternalCredentials` class implementing
the required behavior.

é    Né   )Úas_bytesc                   @   s>   e Zd ZdZdZddd„Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dS )ÚPlainCredentialsa*  A credentials object for the default authentication methodology with
    RabbitMQ.

    If you do not pass in credentials to the ConnectionParameters object, it
    will create credentials for 'guest' with the password of 'guest'.

    If you pass True to erase_on_connect the credentials will not be stored
    in memory after the Connection attempt has been made.

    :param str username: The username to authenticate with
    :param str password: The password to authenticate with
    :param bool erase_on_connect: erase credentials on connect.

    ÚPLAINFc                 C   s   || _ || _|| _dS )zöCreate a new instance of PlainCredentials

        :param str username: The username to authenticate with
        :param str password: The password to authenticate with
        :param bool erase_on_connect: erase credentials on connect.

        N)ÚusernameÚpasswordÚerase_on_connect)Úselfr   r   r   © r
   ú`/var/www/html/tatsat2dev/dashboard-backend/venv/lib/python3.10/site-packages/pika/credentials.pyÚ__init__*   s   
zPlainCredentials.__init__c                 C   s2   t |tƒr| j|jko| j|jko| j|jkS tS ©N)Ú
isinstancer   r   r   r   ÚNotImplemented©r	   Úotherr
   r
   r   Ú__eq__6   s   

ÿ
þzPlainCredentials.__eq__c                 C   ó   |   |¡}|tur| S tS r   ©r   r   ©r	   r   Úresultr
   r
   r   Ú__ne__=   ó   
zPlainCredentials.__ne__c                 C   s>   t tjƒt |jƒ ¡ vrdS tjdt | jƒ d t | jƒ fS )z¯Validate that this type of authentication is supported

        :param spec.Connection.Start start: Connection.Start method
        :rtype: tuple(str|None, str|None)

        ©NNó    )r   r   ÚTYPEÚ
mechanismsÚsplitr   r   ©r	   Ústartr
   r
   r   Úresponse_forC   s   ÿþzPlainCredentials.response_forc                 C   s$   | j rt d¡ d| _d| _dS dS )ú<Called by Connection when it no longer needs the credentialsz Erasing stored credential valuesN)r   ÚLOGGERÚinfor   r   ©r	   r
   r
   r   Úerase_credentialsQ   s
   

ýz"PlainCredentials.erase_credentialsN)F©
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r    r%   r
   r
   r
   r   r      s    
r   c                   @   s<   e Zd ZdZdZdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Z	dS )ÚExternalCredentialsz†The ExternalCredentials class allows the connection to use EXTERNAL
    authentication, generally with a client SSL certificate.

    ÚEXTERNALc                 C   s
   d| _ dS )z,Create a new instance of ExternalCredentialsFN)r   r$   r
   r
   r   r   `   s   
zExternalCredentials.__init__c                 C   s   t |tƒr| j|jkS tS r   )r   r+   r   r   r   r
   r
   r   r   d   s   
zExternalCredentials.__eq__c                 C   r   r   r   r   r
   r
   r   r   i   r   zExternalCredentials.__ne__c                 C   s&   t tjƒt |jƒ ¡ vrdS tjdfS )zµValidate that this type of authentication is supported

        :param spec.Connection.Start start: Connection.Start method
        :rtype: tuple(str or None, str or None)

        r   ó    )r   r+   r   r   r   r   r
   r
   r   r    o   s
   ÿ
z ExternalCredentials.response_forc                 C   s   t  d¡ dS )r!   z&Not supported by this Credentials typeN)r"   Údebugr$   r
   r
   r   r%   {   s   z%ExternalCredentials.erase_credentialsNr&   r
   r
   r
   r   r+   Y   s    r+   )r*   ÚloggingÚcompatr   Ú	getLoggerr'   r"   Úobjectr   r+   ÚVALID_TYPESr
   r
   r
   r   Ú<module>   s    
@(