§
    Âi«  ã                   ó¦   — d Z ddlZddlZddlZddlZddlmZ  G d„ dej        ¦  «        Z G d„ de	¦  «        Z
 G d„ d	ej        ¬
¦  «        Zd„ ZdS )a'  OAuth 2.0 Utilities.

This module provides implementations for various OAuth 2.0 utilities.
This includes `OAuth error handling`_ and
`Client authentication for OAuth flows`_.

OAuth error handling
--------------------
This will define interfaces for handling OAuth related error responses as
stated in `RFC 6749 section 5.2`_.
This will include a common function to convert these HTTP error responses to a
:class:`google.auth.exceptions.OAuthError` exception.


Client authentication for OAuth flows
-------------------------------------
We introduce an interface for defining client authentication credentials based
on `RFC 6749 section 2.3.1`_. This will expose the following
capabilities:

    * Ability to support basic authentication via request header.
    * Ability to support bearer token authentication via request header.
    * Ability to support client ID / secret authentication via request body.

.. _RFC 6749 section 2.3.1: https://tools.ietf.org/html/rfc6749#section-2.3.1
.. _RFC 6749 section 5.2: https://tools.ietf.org/html/rfc6749#section-5.2
é    N)Ú
exceptionsc                   ó   — e Zd ZdZdZdS )ÚClientAuthTypeé   é   N)Ú__name__Ú
__module__Ú__qualname__ÚbasicÚrequest_body© ó    ú]/var/www/html/jarvis.com/web/backend/venv/lib/python3.11/site-packages/google/oauth2/utils.pyr   r   5   s   € € € € € Ø€EØ€L€L€Lr   r   c                   ó   — e Zd ZdZdd„ZdS )ÚClientAuthenticationz“Defines the client authentication credentials for basic and request-body
    types based on https://tools.ietf.org/html/rfc6749#section-2.3.1.
    Nc                 ó0   — || _         || _        || _        dS )a€  Instantiates a client authentication object containing the client ID
        and secret credentials for basic and response-body auth.

        Args:
            client_auth_type (google.oauth2.oauth_utils.ClientAuthType): The
                client authentication type.
            client_id (str): The client ID.
            client_secret (Optional[str]): The client secret.
        N)Úclient_auth_typeÚ	client_idÚclient_secret)Úselfr   r   r   s       r   Ú__init__zClientAuthentication.__init__?   s!   € ð !1ˆÔØ"ˆŒØ*ˆÔÐÐr   ©N)r   r	   r
   Ú__doc__r   r   r   r   r   r   :   s2   € € € € € ðð ð+ð +ð +ð +ð +ð +r   r   c                   ó<   ‡ — e Zd ZdZdˆ fd„	Z	 dd„Zdd„Zd„ Zˆ xZS )	ÚOAuthClientAuthHandlerzUAbstract class for handling client authentication in OAuth-based
    operations.
    Nc                 ód   •— t          t          | ¦  «                             ¦   «          || _        dS )zîInstantiates an OAuth client authentication handler.

        Args:
            client_authentication (Optional[google.oauth2.utils.ClientAuthentication]):
                The OAuth client authentication credentials if available.
        N)Úsuperr   r   Ú_client_authentication)r   Úclient_authenticationÚ	__class__s     €r   r   zOAuthClientAuthHandler.__init__S   s0   ø€ õ 	Õ$ dÑ+Ô+×4Ò4Ñ6Ô6Ð6Ø&;ˆÔ#Ð#Ð#r   c                 ód   — |                       ||¦  «         |€|                      |¦  «         dS dS )a¼  Applies client authentication on the OAuth request's headers or POST
        body.

        Args:
            headers (Mapping[str, str]): The HTTP request header.
            request_body (Optional[Mapping[str, str]]): The HTTP request body
                dictionary. For requests that do not support request body, this
                is None and will be ignored.
            bearer_token (Optional[str]): The optional bearer token.
        N)Ú_inject_authenticated_headersÚ"_inject_authenticated_request_body)r   Úheadersr   Úbearer_tokens       r   Ú#apply_client_authentication_optionsz:OAuthClientAuthHandler.apply_client_authentication_options]   sB   € ð 	×*Ò*¨7°LÑAÔAÐAàÐØ×3Ò3°LÑAÔAÐAÐAÐAð  Ðr   c                 ó"  — |�
d|z  |d<   d S | j         �y| j         j        t          j        u rc| j         j        }| j         j        pd}t          j        |›d|›�                     ¦   «         ¦  «         	                    ¦   «         }d|z  |d<   d S d S d S )Nz	Bearer %sÚAuthorizationÚ ú:zBasic %s)
r   r   r   r   r   r   Úbase64Ú	b64encodeÚencodeÚdecode)r   r$   r%   ÚusernameÚpasswordÚcredentialss         r   r"   z4OAuthClientAuthHandler._inject_authenticated_headersp   s²   € ØÐ#Ø'2°\Ñ'AˆG�OÑ$Ð$Ð$àÔ'Ð3ØÔ+Ô<ÅÔ@TÐTÐTàÔ2Ô<ˆHØÔ2Ô@ÐFÀBˆHå Ô*Ø$˜H˜H h hÐ/×7Ò7Ñ9Ô9ñô çŠf‰hŒhð ð (2°KÑ'?ˆG�OÑ$Ð$Ð$ð 4Ð3ØTÐTr   c                 ó¸   — | j         �P| j         j        t          j        u r:|€t	          j        d¦  «        ‚| j         j        |d<   | j         j        pd|d<   d S d S d S )Nz*HTTP request does not support request-bodyr   r)   r   )r   r   r   r   r   Ú
OAuthErrorr   r   )r   r   s     r   r#   z9OAuthClientAuthHandler._inject_authenticated_request_body   s†   € àÔ'Ð3ØÔ+Ô<ÝÔ*ð+ð +ð Ð#Ý Ô+Ø@ñô ð ð -1Ô,GÔ,Q�˜[Ñ)àÔ/Ô=ÐCÀð ˜_Ñ-Ð-Ð-ð 4Ð3ð+ð +r   r   )NN)	r   r	   r
   r   r   r&   r"   r#   Ú__classcell__)r    s   @r   r   r   N   s‹   ø€ € € € € ðð ð<ð <ð <ð <ð <ð <ð 8<ðBð Bð Bð Bð&@ð @ð @ð @ðð ð ð ð ð ð r   r   )Ú	metaclassc                 óÜ  — 	 g }t          j        | ¦  «        }|                     d                     |d         ¦  «        ¦  «         d|v r.|                     d                     |d         ¦  «        ¦  «         d|v r.|                     d                     |d         ¦  «        ¦  «         d                     |¦  «        }n# t
          t          f$ r | }Y nw xY wt          j        || ¦  «        ‚)zÕTranslates an error response from an OAuth operation into an
    OAuthError exception.

    Args:
        response_body (str): The decoded response data.

    Raises:
        google.auth.exceptions.OAuthError
    zError code {}ÚerrorÚerror_descriptionz: {}Ú	error_uriz - {}r)   )	ÚjsonÚloadsÚappendÚformatÚjoinÚKeyErrorÚ
ValueErrorr   r3   )Úresponse_bodyÚerror_componentsÚ
error_dataÚerror_detailss       r   Úhandle_error_responserE   �   sö   € ð&ØÐÝ”Z Ñ.Ô.ˆ
à×Ò × 6Ò 6°zÀ'Ô7JÑ KÔ KÑLÔLÐLØ *Ð,Ð,Ø×#Ò# F§M¢M°*Ð=PÔ2QÑ$RÔ$RÑSÔSÐSØ˜*Ð$Ð$Ø×#Ò# G§N¢N°:¸kÔ3JÑ$KÔ$KÑLÔLÐLØŸšÐ 0Ñ1Ô1ˆˆøå•jÐ!ð &ð &ð &Ø%ˆˆˆð&øøøõ Ô
 ¨}Ñ
=Ô
=Ð=s   ‚B=C  Ã CÃC)r   Úabcr+   Úenumr:   Úgoogle.authr   ÚEnumr   Úobjectr   ÚABCMetar   rE   r   r   r   ú<module>rL      sè   ððð ð8 €
€
€
Ø €€€Ø €€€Ø €€€à "Ð "Ð "Ð "Ð "Ð "ð
ð ð ð ð �T”Yñ ô ð ð
+ð +ð +ð +ð +˜6ñ +ô +ð +ð(?ð ?ð ?ð ?ð ? s¤{ð ?ñ ?ô ?ð ?ðD>ð >ð >ð >ð >r   