Ë
    3i'  ã                   ój   — d Z ddlmZmZmZ ddlmZ ddlmZ ddlmZ erddl	m
Z
 d	Z G d
„ d	e«      Zy)z%Clear Password Authentication Plugin.é    )ÚTYPE_CHECKINGÚAnyÚOptionalé   )Úerrors)Úloggeré   )ÚMySQLAuthPlugin)ÚMySQLSocketÚMySQLClearPasswordAuthPluginc                   óz   — e Zd ZdZdefd„Zedefd„«       Zede	fd„«       Z
dededee   fd„Zd	d
dededefd„Zy)r   zAClass implementing the MySQL Clear Password authentication pluginÚreturnc                 ó<   — | j                   j                  «       dz   S )znPrepare and return password as as clear text.

        Returns:
            bytes: Prepared password.
        ó    )Ú	_passwordÚencode©Úselfs    úQD:\jyotish\venv\Lib\site-packages\mysql/connector/plugins/mysql_clear_password.pyÚ_prepare_passwordz.MySQLClearPasswordAuthPlugin._prepare_password.   s   € ð ~‰~×$Ñ$Ó&¨Ñ0Ð0ó    c                  ó   — y)zPlugin official name.Úmysql_clear_password© r   s    r   Únamez!MySQLClearPasswordAuthPlugin.name6   s   € ð &r   c                  ó   — y)z'Signals whether or not SSL is required.Tr   r   s    r   Úrequires_sslz)MySQLClearPasswordAuthPlugin.requires_ssl;   s   € ð r   Ú	auth_dataÚkwargsc                 ó–   — | j                   r.| j                  s"t        j                  | j                  › d«      ‚| j                  «       S )zÃReturn the prepared password to send to MySQL.

        Raises:
            InterfaceError: When SSL is required by not enabled.

        Returns:
            str: The prepared password.
        z requires SSL)r   Ú_ssl_enabledr   ÚInterfaceErrorr   r   )r   r   r   s      r   Úauth_responsez*MySQLClearPasswordAuthPlugin.auth_response@   s@   € ð ×Ò T×%6Ò%6Ü×'Ñ'¨4¯9©9¨+°]Ð(CÓDÐDØ×%Ñ%Ó'Ð'r   Úsockr   c                 ó  —  | j                   |fi |¤Ž}|€t        j                  d«      ‚t        j                  d|t        |«      «       |j                  |«       t        |j                  «       «      }t        j                  d|«       |S )aS  Handles server's `auth switch request` response.

        Args:
            sock: Pointer to the socket connection.
            auth_data: Plugin provided data (extracted from a packet
                       representing an `auth switch request` response).
            kwargs: Custom configuration to be passed to the auth plugin
                    when invoked. The parameters defined here will override the ones
                    defined in the auth plugin itself.

        Returns:
            packet: Last server's response after back-and-forth
                    communication.
        zGot a NULL auth responsez# request: %s size: %sz# server response packet: %s)	r#   r   r"   r   ÚdebugÚlenÚsendÚbytesÚrecv)r   r$   r   r   ÚresponseÚpkts         r   Úauth_switch_responsez1MySQLClearPasswordAuthPlugin.auth_switch_responseM   sx   € ð" &4×%Ñ% iÑ:°6Ñ:ˆØÐÜ×'Ñ'Ð(BÓCÐCä‰Ð-¨x¼¸X»ÔGØ	‰	(ÔäD—I‘I“KÓ ˆÜ‰Ð3°SÔ9àˆ
r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r)   r   ÚpropertyÚstrr   Úboolr   r   r   r#   r-   r   r   r   r   r   +   sŠ   „ ÙKð1 5ó 1ð ð&cò &ó ð&ð ð˜dò ó ðð( uð (¸ð (ÀÈÁó (ðØ!ðØ.3ðØ?Bðà	ôr   N)r1   Útypingr   r   r   Ú r   r   r
   Únetworkr   ÚAUTHENTICATION_PLUGIN_CLASSr   r   r   r   Ú<module>r9      s1   ðñ: ,ç /Ñ /å Ý Ý áÝ%à<Ð ô= ?õ =r   