ó
    æk7i°  ã                   óx   • S SK r SSKJr  SSKJr  SSKJr  SSKJr  \ R                  " \	5      r
 " S S	\\5      rg)
é    Né   )ÚUnauthorizedClientError)Úhookedé   )Ú	BaseGrant)ÚTokenEndpointMixinc                   ó2   • \ rS rSrSrSrS r\S 5       rSr	g)ÚClientCredentialsGranté   a„  The client can request an access token using only its client
credentials (or other supported means of authentication) when the
client is requesting access to the protected resources under its
control, or those of another resource owner that have been previously
arranged with the authorization server.

The client credentials grant type MUST only be used by confidential
clients::

    +---------+                                  +---------------+
    |         |                                  |               |
    |         |>--(A)- Client Authentication --->| Authorization |
    | Client  |                                  |     Server    |
    |         |<--(B)---- Access Token ---------<|               |
    |         |                                  |               |
    +---------+                                  +---------------+

https://tools.ietf.org/html/rfc6749#section-4.4
Úclient_credentialsc                 ó  • U R                  5       n[        R                  SU5        UR                  U R                  5      (       d  [        SU R                   S35      eXR                  l        U R                  5         g)av  The client makes a request to the token endpoint by adding the
following parameters using the "application/x-www-form-urlencoded"
format per Appendix B with a character encoding of UTF-8 in the HTTP
request entity-body:

grant_type
     REQUIRED.  Value MUST be set to "client_credentials".

scope
     OPTIONAL.  The scope of the access request as described by
     Section 3.3.

The client MUST authenticate with the authorization server as
described in Section 3.2.1.

For example, the client makes the following HTTP request using
transport-layer security (with extra line breaks for display purposes
only):

.. code-block:: http

    POST /token HTTP/1.1
    Host: server.example.com
    Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW
    Content-Type: application/x-www-form-urlencoded

    grant_type=client_credentials

The authorization server MUST authenticate the client.
zValidate token request of %rz0The client is not authorized to use 'grant_type=Ú'N)	Ú"authenticate_token_endpoint_clientÚlogÚdebugÚcheck_grant_typeÚ
GRANT_TYPEr   ÚrequestÚclientÚvalidate_requested_scope)Úselfr   s     Új/home/james-whalen/.local/lib/python3.13/site-packages/authlib/oauth2/rfc6749/grants/client_credentials.pyÚvalidate_token_requestÚ-ClientCredentialsGrant.validate_token_request"   sn   € ðB ×8Ñ8Ó:ˆÜ	‰	Ð0°&Ô9à×&Ñ& t§¡×7Ñ7Ü)ØBÀ4Ç?Á?ÐBSÐSTÐUóð ð %‰ÔØ×%Ñ%Õ'ó    c                 óÜ   • U R                  U R                  R                  R                  SS9n[        R                  SXR                  5        U R                  U5        SXR                  4$ )a¤  If the access token request is valid and authorized, the
authorization server issues an access token as described in
Section 5.1.  A refresh token SHOULD NOT be included.  If the request
failed client authentication or is invalid, the authorization server
returns an error response as described in Section 5.2.

An example successful response:

.. code-block:: http

    HTTP/1.1 200 OK
    Content-Type: application/json
    Cache-Control: no-store
    Pragma: no-cache

    {
        "access_token":"2YotnFZFEjr1zCsicMWpAA",
        "token_type":"example",
        "expires_in":3600,
        "example_parameter":"example_value"
    }

:returns: (status_code, body, headers)
F)ÚscopeÚinclude_refresh_tokenzIssue token %r to %réÈ   )	Úgenerate_tokenr   Úpayloadr   r   r   r   Ú
save_tokenÚTOKEN_RESPONSE_HEADER)r   Útokens     r   Úcreate_token_responseÚ,ClientCredentialsGrant.create_token_responseN   s`   € ð4 ×#Ñ#Ø—,‘,×&Ñ&×,Ñ,ÀEð $ð 
ˆô 		‰	Ð(¨%·±Ô=Ø‰˜ÔØE×5Ñ5Ð5Ð5r   © N)
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r   r%   Ú__static_attributes__r'   r   r   r
   r
      s(   † ñð( &€Jò*(ðX ñ6ó ó6r   r
   )ÚloggingÚerrorsr   Úhooksr   Úbaser   r   Ú	getLoggerr(   r   r
   r'   r   r   Ú<module>r3      s5   ðÛ å ,Ý Ý Ý $à×Ò˜Ó!€ôb6˜YÐ(:õ b6r   