Ë
    ”Âi‘  ã                   ó€   — d Z ddlZddlmZ ddlmZ  ej                  e«      ZdgZ	 G d„ d«      Z
d„ Zd	„ Zd
„ Zdd„Zy)a¼  authlib.oauth2.rfc6749.authenticate_client.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Registry of client authentication methods, with 3 built-in methods:

1. client_secret_basic
2. client_secret_post
3. none

The "client_secret_basic" method is used a lot in examples of `RFC6749`_,
but the concept of naming are introduced in `RFC7591`_.

.. _`RFC6749`: https://tools.ietf.org/html/rfc6749
.. _`RFC7591`: https://tools.ietf.org/html/rfc7591
é    Né   ©ÚInvalidClientError)Úextract_basic_authorizationÚClientAuthenticationc                   ó&   — e Zd Zd„ Zd„ Zd„ Zdd„Zy)r   c                 ó@   — || _         t        t        t        dœ| _        y )N)ÚnoneÚclient_secret_basicÚclient_secret_post)Úquery_clientÚauthenticate_noneÚ authenticate_client_secret_basicÚauthenticate_client_secret_postÚ_methods)Úselfr   s     úb/var/www/timesheet/venv/lib/python3.12/site-packages/authlib/oauth2/rfc6749/authenticate_client.pyÚ__init__zClientAuthentication.__init__   s   € Ø(ˆÔä%Ü#CÜ"Añ
ˆ�ó    c                 ó"   — || j                   |<   y ©N)r   )r   ÚmethodÚfuncs      r   ÚregisterzClientAuthentication.register$   s   € Ø $ˆ�‰�fÒr   c                 óÚ   — |D ]D  }| j                   |   } || j                  |«      }|sŒ(|j                  ||«      sŒ;||_        |c S  d|v rt	        dd|› �¬«      ‚t	        d|› �¬«      ‚)Nr   é‘  z-The client cannot authenticate with methods: ©Ústatus_codeÚdescription)r   )r   r   Úcheck_endpoint_auth_methodÚauth_methodr   )r   ÚrequestÚmethodsÚendpointr   r   Úclients          r   Úauthenticatez!ClientAuthentication.authenticate'   s�   € Øò 	ˆFØ—=‘= Ñ(ˆDÙ˜$×+Ñ+¨WÓ5ˆFÚ˜&×;Ñ;¸FÀHÕMØ&,�Ô#Ø’ð	ð ! GÑ+Ü$ØØKÈGÈ9ÐUôð ô !ØGÈÀyÐQô
ð 	
r   c                 ó(   — | j                  |||«      S r   )r&   )r   r"   r#   r$   s       r   Ú__call__zClientAuthentication.__call__8   s   € Ø× Ñ  ¨'°8Ó<Ð<r   N)Útoken)Ú__name__Ú
__module__Ú__qualname__r   r   r&   r(   © r   r   r   r      s   „ ò
ò%ò
ô"=r   c                 óà   — t        |j                  «      \  }}|r;|r9t        | |d«      }|j                  |«      rt        j                  d|› d�«       |S t        j                  d|› d�«       y)znAuthenticate client by ``client_secret_basic`` method. The client
    uses HTTP Basic for authentication.
    r   úAuthenticate z" via "client_secret_basic" successz! via "client_secret_basic" failedN)r   ÚheadersÚ_validate_clientÚcheck_client_secretÚlogÚdebug)r   r"   Ú	client_idÚclient_secretr%   s        r   r   r   <   si   € ô  ;¸7¿?¹?ÓKÑ€Iˆ}Ù‘]Ü! ,°	¸3Ó?ˆØ×%Ñ% mÔ4Ü�I‰I˜ i [Ð0RÐSÔTØˆMÜ‡I�I�˜i˜[Ð(IÐJÕKr   c                 ó
  — |j                   }|j                  d«      }|j                  d«      }|r:|r8t        | |«      }|j                  |«      rt        j                  d|› d�«       |S t        j                  d|› d�«       y)zrAuthenticate client by ``client_secret_post`` method. The client
    uses POST parameters for authentication.
    r5   r6   r/   z! via "client_secret_post" successz  via "client_secret_post" failedN)ÚformÚgetr1   r2   r3   r4   )r   r"   Údatar5   r6   r%   s         r   r   r   I   sy   € ð �<‰<€DØ—‘˜Ó%€IØ—H‘H˜_Ó-€MÙ‘]Ü! ,°	Ó:ˆØ×%Ñ% mÔ4Ü�I‰I˜ i [Ð0QÐRÔSØˆMÜ‡I�I�˜i˜[Ð(HÐIÕJr   c                 óþ   — |j                   j                  }|rL|j                   j                  j                  d«      s't	        | |«      }t
        j                  d|› d�«       |S t
        j                  d|› d�«       y)zaAuthenticate public client by ``none`` method. The client
    does not have a client secret.
    r6   r/   z via "none" successz via "none" failedN)Úpayloadr5   r:   r9   r1   r3   r4   )r   r"   r5   r%   s       r   r   r   X   sj   € ð —‘×)Ñ)€IÙ˜Ÿ™×-Ñ-×1Ñ1°/ÔBÜ! ,°	Ó:ˆÜ�	‰	�M ) Ð,?Ð@ÔAØˆÜ‡I�I�˜i˜[Ð(:Ð;Õ<r   c                 óR   — |€t        |d¬«      ‚ | |«      }|st        |d¬«      ‚|S )NzMissing 'client_id' parameter.r   z)The client does not exist on this server.r   )r   r5   r   r%   s       r   r1   r1   d   sD   € ØÐÜ Ø#Ø8ô
ð 	
ñ
 ˜)Ó$€FÙÜ Ø#ØCô
ð 	
ð
 €Mr   )i�  )Ú__doc__ÚloggingÚerrorsr   Úutilr   Ú	getLoggerr*   r3   Ú__all__r   r   r   r   r1   r-   r   r   ú<module>rD      sP   ðñó  å &Ý -à€g×Ñ˜Ó!€à!Ð
"€÷=ñ =òB
LòKò	=ôr   