Ë
    aQbj…  ã            	       óÈ   — d Z ddlZddlmZmZ ddlmZ ddlmZm	Z	m
Z
mZ ddlmZmZ ddlmZ erdd	lmZ d
Z G d„ de«      Z edd¬«      	 ddede
e   dee   fd„«       Zy)z!Base Authentication Plugin class.é    N)ÚABCÚabstractmethod)Ú	lru_cache)ÚTYPE_CHECKINGÚAnyÚOptionalÚTypeé   )ÚNotSupportedErrorÚProgrammingError)Úlogger)ÚMySQLSocketzmysql.connector.pluginsc            	       óà   — e Zd ZdZ	 ddedededdfd„Zedefd„«       Zee	defd	„«       «       Z
ee	defd
„«       «       Ze	dededee   fd„«       Zdddededefd„Ze	dddededefd„«       Zy)ÚMySQLAuthPluginzAuthorization plugin interface.ÚusernameÚpasswordÚssl_enabledÚreturnNc                 ó>   — |€dn|| _         |€dn|| _        || _        y)zConstructor.NÚ )Ú	_usernameÚ	_passwordÚ_ssl_enabled)Úselfr   r   r   s       úS/var/www/html/venv/lib/python3.12/site-packages/mysql/connector/plugins/__init__.pyÚ__init__zMySQLAuthPlugin.__init__1   s(   € ð %-Ð$4™b¸(ˆŒØ$,Ð$4™b¸(ˆŒØ"-ˆÕó    c                 ó   — | j                   S )z&Signals whether or not SSL is enabled.)r   ©r   s    r   r   zMySQLAuthPlugin.ssl_enabled<   s   € ð × Ñ Ð r   c                  ó   — y)z'Signals whether or not SSL is required.N© r   s    r   Úrequires_sslzMySQLAuthPlugin.requires_sslA   ó   � r   c                  ó   — y)zPlugin official name.Nr!   r   s    r   ÚnamezMySQLAuthPlugin.nameF   r#   r   Ú	auth_dataÚkwargsc                  ó   — y)aˆ  Make the client's authorization response.

        Args:
            auth_data: Authorization data.
            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: Client's authorization response.
        Nr!   )r   r&   r'   s      r   Úauth_responsezMySQLAuthPlugin.auth_responseK   r#   r   Úsockr   c                 ó   — t         ‚)a1  Handles server's `auth more data` response.

        Args:
            sock: Pointer to the socket connection.
            auth_data: Authentication method data (from a packet representing
                       an `auth more data` 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.
        )ÚNotImplementedError©r   r*   r&   r'   s       r   Úauth_more_responsez"MySQLAuthPlugin.auth_more_responseY   s
   € ô  "Ð!r   c                  ó   — y)a?  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.
        Nr!   r-   s       r   Úauth_switch_responsez$MySQLAuthPlugin.auth_switch_responsek   r#   r   )F)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚstrÚboolr   Úpropertyr   r   r"   r%   Úbytesr   r   r)   r.   r0   r!   r   r   r   r   .   s  „ Ù)ð "ñ		.àð	.ð ð	.ð ð		.ð
 
ó	.ð ð!˜Tò !ó ð!ð Øð6˜dò 6ó ó ð6ð Øð$�cò $ó ó ð$ð ð uð ¸ð ÀÈÁò ó ðð"Ø!ð"Ø.3ð"Ø?Bð"à	ó"ð$ ðØ!ðØ.3ðØ?Bðà	òó ñr   r   é
   F)ÚmaxsizeÚtypedÚplugin_nameÚauth_plugin_classr   c                 óÂ  — t         }| r‚	 t        j                  d|«       t        j                  d| «       t        j                  d| › �|«      }|rt        ||«      s|j                  }t        j                  d|«       t        ||«      S t        d| › d	�«      ‚# t        $ r }t        j                  d|«       Y d}~Œ3d}~wt        $ r}t        d|› �«      |‚d}~ww xY w)
aÂ  Return authentication class based on plugin name

    This function returns the class for the authentication plugin plugin_name.
    The returned class is a subclass of BaseAuthPlugin.

    Args:
        plugin_name (str): Authentication plugin name.
        auth_plugin_class (str): Authentication plugin class name.

    Raises:
        NotSupportedError: When plugin_name is not supported.

    Returns:
        Subclass of `MySQLAuthPlugin`.
    zpackage: %szplugin_name: %sú.zAUTHENTICATION_PLUGIN_CLASS: %sz"Requested Module was not found: %sNzInvalid module name: zAuthentication plugin 'z' is not supported)ÚDEFAULT_PLUGINS_PKGr   ÚinfoÚ	importlibÚimport_moduleÚhasattrÚAUTHENTICATION_PLUGIN_CLASSÚgetattrÚModuleNotFoundErrorÚwarningÚ
ValueErrorr   r   )r<   r=   ÚpackageÚplugin_moduleÚerrs        r   Úget_auth_pluginrM   ~   sÜ   € ô( "€GÙð	KÜ�K‰K˜ wÔ/Ü�K‰KÐ)¨;Ô7Ü%×3Ñ3°a¸°}Ð4EÀwÓOˆMÙ$¬G°MÐCTÔ,UØ$1×$MÑ$MÐ!Ü�K‰KÐ9Ð;LÔMÜ˜=Ð*;Ó<Ð<ô
 Ð5°k°]ÐBTÐUÓ
VÐVøô	 #ò 	FÜ�N‰NÐ?À×EÑEûÜò 	KÜ"Ð%:¸3¸%Ð#@ÓAÀsÐJûð	Kús$   ŠB B Â	CÂ#B>Â>CÃ
CÃC)N)r4   rB   Úabcr   r   Ú	functoolsr   Útypingr   r   r   r	   Úerrorsr   r   r   Únetworkr   r@   r   r5   rM   r!   r   r   ú<module>rS      s‚   ðñ: (ã ç #Ý ß 5Ó 5ç 8Ý áÝ%à/Ð ôM�cô Mñ` �2˜UÔ#ð (,ñ!WØð!Wà ‘}ð!Wð 
ˆ/Ñò!Wó $ñ!Wr   