� J�g� ���ddlZddlmZmZddlmZmZddlmZddl m Z d�Z d�Z d �Z Gd �d ��ZGd �d ��ZdS)�N)�add_params_to_qs�add_params_to_uri)�to_bytes� to_native�)� OAuth2Token)�add_bearer_tokenc��|j�d|j��}ttjt |d������}d|��|d<|||fS)N�:�latin1zBasic � Authorization)� client_id� client_secretr�base64� b64encoder)�client�method�uri�headers�body�text�auths �c/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/authlib/oauth2/auth.py�encode_client_secret_basicrsZ���� 7� 7��!5� 7� 7�D� �V�%�h�t�X�&>�&>�?�?� @� @�D�.����G�O�� ��� ��c��t|pdd|jfd|jpdfg��}d|vrtt |����|d<|||fS)N�rr�Content-Length)rrr�str�len�rrrrrs r�encode_client_secret_postr"sh�� �D�J�B� �f�&�'� �&�.�4�"�5�)� � �D��7�"�"�$'��D� � �N�N�� �!� ��� �rc���|dkrt|d|jfg��}|||fSt|d|jfg��}d|vrtt |����|d<|||fS)N�GETrr)rrrrr r!s r� encode_noner%s{�� ������{�F�4D�&E�%F�G�G���G�T�!�!� �D�K��1A�#B�"C� D� D�D��7�"�"�$'��D� � �N�N�� �!� ��� �rc�,�eZdZdZeeed�Zdd�Zd�Z dS)� ClientAutha�Attaches OAuth Client Information to HTTP requests. :param client_id: Client ID, which you get from client registration. :param client_secret: Client Secret, which you get from registration. :param auth_method: Client auth method for token endpoint. The supported methods for now: * client_secret_basic (default) * client_secret_post * none )�client_secret_basic�client_secret_post�noneNc�d�|�d}||_||_||jvr |j|}||_dS)Nr()rr�DEFAULT_AUTH_METHODS� auth_method)�selfrrr-s r�__init__zClientAuth.__init__5sE�� � �/�K�"���*��� �$�3� 3� 3��3�K�@�K�&����rc�4�|�|||||��S�N)r-)r.rrrrs r�preparezClientAuth.prepareAs������f�c�7�D�A�A�Arr1) �__name__� __module__� __qualname__�__doc__rr"r%r,r/r2�rrr'r'#s^������ � � :�7����� '� '� '� '�B�B�B�B�Brr'c�8�eZdZdZdZdeiZd d�Zd�Zd�Z d�Z dS) � TokenAuthaAttach token information to HTTP requests. :param token: A dict or OAuth2Token instance of an OAuth 2.0 token :param token_placement: The placement of the token, default is ``header``, available choices: * header (default) * body * uri �bearer�headerNc�z�tj|��|_||_||_t ��|_dSr1)r� from_dict�token�token_placementr�set�hooks)r.r>r?rs rr/zTokenAuth.__init__Us2�� �*�5�1�1�� �.����� ��U�U�� � � rc�8�tj|��|_dSr1)rr=r>)r.r>s r� set_tokenzTokenAuth.set_token[s�� �*�5�1�1�� � � rc��|j�d|j��}|j|���}||jd||||j��\}}}|jD]}||||��\}}}�|||fS)N� token_type� access_token)r>�get�DEFAULT_TOKEN_TYPE� SIGN_METHODS�lowerr?rA)r.rrrrE�sign�hooks rr2zTokenAuth.prepare^s����Z�^�^�L�$�2I�J�J� �� ��!1�!1�!3�!3�4��!�T� �J�~� &� ��$� � �"�"���W�d� �J� :� :�D�!%��c�7�D�!9�!9� �C��$�$��G�T�!�!rc��|`|`dSr1)rrA)r.s r�__del__zTokenAuth.__del__ks�� �K� �J�J�Jr)r;N) r3r4r5r6rHr rIr/rCr2rNr7rrr9r9Est������ � �"���"��L����� 2�2�2� "� "� "�����rr9)r�authlib.common.urlsrr�authlib.common.encodingrr�rfc6749r�rfc6750r rr"r%r'r9r7rr�<module>rSs��� � � � �C�C�C�C�C�C�C�C�7�7�7�7�7�7�7�7� � � � � � �%�%�%�%�%�%����������B�B�B�B�B�B�B�B�D(�(�(�(�(�(�(�(�(�(r
Memory