
    k7i                         S r SSKrSSKJr  SSKJr  \R                  " \5      rS/r	 " S S5      r
S rS	 rS
 rSS jrg)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                   0    \ rS rSrS rS rS rSS jrSrg)	r      c                 >    Xl         [        [        [        S.U l        g )N)noneclient_secret_basicclient_secret_post)query_clientauthenticate_none authenticate_client_secret_basicauthenticate_client_secret_post_methods)selfr   s     d/home/james-whalen/.local/lib/python3.13/site-packages/authlib/oauth2/rfc6749/authenticate_client.py__init__ClientAuthentication.__init__   s    (%#C"A
    c                      X R                   U'   g N)r   )r   methodfuncs      r   registerClientAuthentication.register$   s     $fr   c                     U HN  nU R                   U   nU" U R                  U5      nU(       d  M.  UR                  XC5      (       d  MF  XAl        Us  $    SU;   a  [	        SSU 3S9e[	        SU 3S9e)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   authenticate!ClientAuthentication.authenticate'   s    F==(D$++W5Fv&;;FMM&,#  !G+$KG9U  !GyQ
 	
r   c                 &    U R                  XU5      $ r   )r)   )r   r%   r&   r'   s       r   __call__ClientAuthentication.__call__8   s      8<<r   )r   r   N)token)	__name__
__module____qualname____firstlineno__r   r   r)   r,   __static_attributes__ r   r   r   r      s    
%
"=r   c                     [        UR                  5      u  p#U(       aD  U(       a=  [        XS5      nUR                  U5      (       a  [        R                  SU S35        U$ [        R                  SU S35        g)zfAuthenticate 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   <   sh      ;7??KI]!,3?%%m44IIi[0RSTMIIi[(IJKr   c                 &   UR                   nUR                  S5      nUR                  S5      nU(       aC  U(       a<  [        X5      nUR                  U5      (       a  [        R                  SU S35        U$ [        R                  SU S35        g)zjAuthenticate client by ``client_secret_post`` method. The client
uses POST parameters for authentication.
r<   r=   r6   z! via "client_secret_post" successz  via "client_secret_post" failedN)formgetr8   r9   r:   r;   )r   r%   datar<   r=   r(   s         r   r   r   I   sz     <<D%IHH_-M]!,:%%m44IIi[0QRSMIIi[(HIJr   c                    UR                   R                  nU(       aP  UR                   R                  R                  S5      (       d&  [	        X5      n[
        R                  SU S35        U$ [
        R                  SU S35        g)zYAuthenticate public client by ``none`` method. The client
does not have a client secret.
r=   r6   z via "none" successz via "none" failedN)payloadr<   rA   r@   r8   r:   r;   )r   r%   r<   r(   s       r   r   r   X   sk     ))I--11/BB!,:		M),?@AIIi[(:;<r   c                 R    Uc
  [        USS9eU " U5      nU(       d
  [        USS9eU$ )NzMissing 'client_id' parameter.r    z)The client does not exist on this server.r   )r   r<   r!   r(   s       r   r8   r8   d   sD     #8
 	

 )$F #C
 	

 Mr   )i  )__doc__loggingerrorsr   utilr   	getLoggerr/   r:   __all__r   r   r   r   r8   r4   r   r   <module>rK      sN      & -!!
"= =B
LK	=r   