%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/oauthlib/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/oauthlib/__pycache__/common.cpython-312.pyc

�

�cA4����dZddlZddlZddlZddlZddlZddlmZddlm	Z
mZm
ZddlmZ	ddlmZmZdZd	Zej2d
ej4�Zej2d�ZdZej<d
�Zd%d�Z	d�Zd�Z
d�Z d�Z!e"e�e"d�zZ#d�Z$d�Z%d�Z&d�Z'defd�Z(d�Z)d�Z*defd�Z+d�Z,d&d�Z-d�Z.d'd �Z/Gd!�d"e0�Z1Gd#�d$�Z2y#e$rddlmZmZY��wxYw)(z|
oauthlib.common
~~~~~~~~~~~~~~

This module provides data structures and utilities common
to all implementations of OAuth.
�N)�quote�unquote�	urlencode�)�	get_debug)�SystemRandom�randbits)r�getrandbits�>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789z_ !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}z&([^&;]*(?:password|token)[^=]*=)[^&;]+z&%[^0-9A-Fa-f]|%[0-9A-Fa-f][^0-9A-Fa-f]zAABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.-�oauthlibc��t|t�r|jd�n|}t||�}t|t�r|jd�}|S�N�utf-8)�
isinstance�str�encode�_quote�bytes�decode)�s�safes  �1/usr/lib/python3/dist-packages/oauthlib/common.pyrr+sE��'��3�/������Q�A��q�$��A��!�U��
�H�H�W����H�c�^�t|�}t|t�r|jd�}|Sr)�_unquoterrr)rs rrr5s*�����A��!�U��
�H�H�W����Hrc�t�t|�}t|�}t|t�r|S|j	d�Sr)�encode_params_utf8�
_urlencoderrr)�params�utf8_params�
urlencodeds   rrr?s7��$�V�,�K��K�(�J��*�c�"���� � ��)�)rc���g}|D]Z\}}|jt|t�r|jd�n|t|t�r|jd�n|f��\|S)ziEnsures that all parameters in a list of 2-element tuples are encoded to
    bytestrings using UTF-8
    r)�appendrrr)r�encoded�k�vs    rrrHsb���G��=���1����!+�A�s�!3�A�H�H�W���!+�A�s�!3�A�H�H�W���<�	=�=��Nrc���g}|D]Z\}}|jt|t�r|jd�n|t|t�r|jd�n|f��\|S)zfEnsures that all parameters in a list of 2-element tuples are decoded to
    unicode using UTF-8.
    r)r#rrr)r�decodedr%r&s    r�decode_params_utf8r)Tsb���G��?���1����!+�A�u�!5�A�H�H�W��1�!+�A�u�!5�A�H�H�W��1�>�	?�?��Nrz=&;:%+~,*@!()/?'$c���|r4t|�tks"d}t|t|�tz
|fz��tj	|�rtd��tj|d��}t|�S)a�Decode a query string in x-www-form-urlencoded format into a sequence
    of two-element tuples.

    Unlike urlparse.parse_qsl(..., strict_parsing=True) urldecode will enforce
    correct formatting of the query string by validation. If validation fails
    a ValueError will be raised. urllib.parse_qsl will only raise errors if
    any of name-value pairs omits the equals sign.
    z�Error trying to decode a non urlencoded string. Found invalid characters: %s in the string: '%s'. Please ensure the request/response body is x-www-form-urlencoded.z%Invalid hex encoding in query string.T��keep_blank_values)�setr!�
ValueError�INVALID_HEX_PATTERN�search�urlparse�	parse_qslr))�query�errorrs   r�	urldecoder5csv��
�S��Z�:�-�*��
��#�e�*�z�"9�5�!A�A�B�B��!�!�%�(��@�A�A��
�
���
>�F��f�%�%rc�T�t|ttf�r	t|�}|St|d�rD	t
|�tt|t�r|j�n|�}t|�}|Sd}|S#t$rd}Y|SwxYw#t$rd}Y|St$rd}Y|SwxYw)a*Extract parameters and return them as a list of 2-tuples.

    Will successfully extract parameters from urlencoded query strings,
    dicts, or lists of 2-tuples. Empty strings/dicts/lists will return an
    empty list of parameters. Any other input will result in a return
    value of None.
    N�__iter__)rrrr5r.�hasattr�dict�list�itemsr)�	TypeError)�rawrs  r�extract_paramsr>�s����#��s�|�$�	��s�^�F� �M�
��j�	!�	0���I���C��)>�#�)�)�+�C�H�F�'��/�F��M����M���	��F��M�	��
�	��F��M��	��F��M�	�s(�A9�B�9B�B�B'�
B'�&B'c�R�tttd��t�z�S)a�Generate pseudorandom nonce that is unlikely to repeat.

    Per `section 3.3`_ of the OAuth 1 RFC 5849 spec.
    Per `section 3.2.1`_ of the MAC Access Authentication spec.

    A random 64-bit number is appended to the epoch timestamp for both
    randomness and to decrease the likelihood of collisions.

    .. _`section 3.2.1`: https://tools.ietf.org/html/draft-ietf-oauth-v2-http-mac-01#section-3.2.1
    .. _`section 3.3`: https://tools.ietf.org/html/rfc5849#section-3.3
    �@)rr	�generate_timestamp�rr�generate_noncerC�s!���s�8�B�<� �#5�#7�7�8�8rc�N�tttj���S)aDGet seconds since epoch (UTC).

    Per `section 3.3`_ of the OAuth 1 RFC 5849 spec.
    Per `section 3.2.1`_ of the MAC Access Authentication spec.

    .. _`section 3.2.1`: https://tools.ietf.org/html/draft-ietf-oauth-v2-http-mac-01#section-3.2.1
    .. _`section 3.3`: https://tools.ietf.org/html/rfc5849#section-3.3
    )r�int�timerBrrrArA�s���s�4�9�9�;�� � r�c�b���t��dj��fd�t|�D��S)aXGenerates a non-guessable OAuth token

    OAuth (1 and 2) does not specify the format of tokens except that they
    should be strings of random characters. Tokens should not be guessable
    and entropy when generating the random characters is important. Which is
    why SystemRandom is used instead of the default random.choice method.
    �c3�@�K�|]}�j�����y�w�N)�choice)�.0�x�chars�rands  ��r�	<genexpr>z!generate_token.<locals>.<genexpr>�s�����=�!�4�;�;�u�%�=�s�)r�join�range)�lengthrOrPs `@r�generate_tokenrU�s%����>�D�
�7�7�=�u�V�}�=�=�=rc��ddl}tjj�}|j|tj|j
��zd�}|j
|j�|j||d�}t|d�}|S)Nr)�seconds)�scope�exp�RS256�UTF-8)
�jwt�datetime�utcnowrX�	timedelta�
expires_in�update�claimsr�
to_unicode)�private_pem�requestr\�nowrb�tokens      r�generate_signed_tokenrh�sw���
�
�
�
"�
"�
$�C�����X�'�'��0B�0B�C�C��F�
�M�M�'�.�.�!��J�J�v�{�G�4�E��u�g�&�E��Lrc�4�ddl}|j||dg��S)NrrZ)�
algorithms)r\r)�
public_pemrgr\s   r�verify_signed_tokenrl�s����:�:�e�Z�W�I�:�>�>rc��t||�S)z�Generates an OAuth client_id

    OAuth 2 specify the format of client_id in
    https://tools.ietf.org/html/rfc6749#appendix-A.
    )rU)rTrOs  r�generate_client_idrn�s���&�%�(�(rc��t|t�r|j�}tj|d��}|j|�t
|�S)z)Extend a query with a list of two-tuples.Tr+)rr9r;r1r2�extendr)r3r�queryparamss   r�add_params_to_qsrr�sB���&�$��������$�$�U�d�C�K����v���[�!�!rc��tj|�\}}}}}}|r
t||�}nt||�}tj||||||f�S)z5Add a list of two-tuples to the uri query components.)r1rr�
urlunparse)	�urir�fragment�sch�net�path�parr3�fras	         r�add_params_to_urir|�sX��&.�&7�&7��&<�#�C��d�C�����s�F�+�� ���/������S�$��U�C�@�A�Arc��t|�t|�k7ryd}t||�D]\}}|t|�t|�zz}�!|dk(S)a Near-constant time string comparison.

    Used in order to avoid timing attacks on sensitive information such
    as secret keys during request verification (`rootLabs`_).

    .. _`rootLabs`: http://rdist.root.org/2010/01/07/timing-independent-array-comparison/

    Fr)�len�zip�ord)�a�b�resultrN�ys     r�safe_string_equalsr��sU���1�v��Q����
�F��A�q�	�"���1��#�a�&�3�q�6�/�!��"��Q�;�rc	�x��t|t�r|St|t�r
t|���St|d�rR	t	|�t|d�r|j�}|D��cic]\}}t
|��t
|����c}}S|Scc}}w#t$rY|St$r�fd�|D�cYSwxYw)z:Convert a number of different types of objects to unicode.)�encodingr7r;c3�6�K�|]}t|�����y�wrK�rc)rM�ir�s  �rrQzto_unicode.<locals>.<genexpr>s�����:��J�q�(�+�:�s�)	rrrr8r9r;rcr<r.)�datar�r%r&s `  rrcrcs�����$������$����4�(�+�+��t�Z� �	W���J��t�W�%��z�z�|��QU�V���A�J�q�(�+�Z��8�-D�D�V�V��K��W���	���K��	;�:�T�:�:�	;�s�B�*!B�	B9�#B9�8B9c�X��eZdZdZiZd�Zd�Z�fd�Z�fd�Zd	d�Z	�fd�Z
�fd�Z�xZS)
�CaseInsensitiveDictz3Basic case insensitive dict with strings only keys.c�t�|D�cic]}|j�|��c}|_|D]
}||||<�ycc}wrK��lower�proxy)�selfr�r%s   r�__init__zCaseInsensitiveDict.__init__-s?��,0�1�q�a�g�g�i��l�1��
��	�A��1�g�D��G�	��2s�5c�:�|j�|jvSrKr�)r�r%s  r�__contains__z CaseInsensitiveDict.__contains__2s���w�w�y�D�J�J�&�&rc���|j|j�}t�|�
|�|j|j�=yrK)r�r��super�__delitem__�r�r%�key�	__class__s   �rr�zCaseInsensitiveDict.__delitem__5s6����j�j�����#��
���C� ��J�J�q�w�w�y�!rc�\��|j|j�}t�|�
|�SrK)r�r�r��__getitem__r�s   �rr�zCaseInsensitiveDict.__getitem__:s'����j�j�����#���w�"�3�'�'rc��||vr||S|SrKrB)r�r%�defaults   r�getzCaseInsensitiveDict.get>s���t�)�t�A�w�0��0rc�`��t�|�||�||j|j�<yrK)r��__setitem__r�r�)r�r%r&r�s   �rr�zCaseInsensitiveDict.__setitem__As&���
���A�q�!� !��
�
�1�7�7�9�rc�~��t�|�|i|��t|i|��D]}||j|j	�<�!yrK)r�rar9r�r�)r��args�kwargsr%r�s    �rrazCaseInsensitiveDict.updateEsA���
����'��'��t�&�v�&�	&�A�$%�D�J�J�q�w�w�y�!�	&rrK)
�__name__�
__module__�__qualname__�__doc__r�r�r�r�r�r�r�ra�
__classcell__)r�s@rr�r�'s3���=��E��
'�"�
(�1�"�&�&rr�c�X�eZdZdZ		d	d�Zd�Zd�Zed��Zed��Z	ed��Z
y)
�Requesta:A malleable representation of a signable HTTP request.

    Body argument may contain any data, but parameters will only be decoded if
    they are one of:

    * urlencoded query string
    * dict
    * list of 2-tuples

    Anything else will be treated as raw body data to be passed through
    unmolested.
    Nc�H���fd�}||�|_||�|_t||xsi��|_||�|_t|j�|_g|_i|_idd�dd�dd�dd�dd�dd�dd�d	d�d
d�dd�dd�d
d�dd�dd�dd�dd�dd�dddddddddddddd�
�|_	|jjtt|j���|jjt|jxsg��y)Nc�$���rt|��S|SrKr�)rNr�s �r�<lambda>z"Request.__init__.<locals>.<lambda>]s���h�:�a��2��A�r�access_token�client�	client_id�
client_secret�code�code_challenge�code_challenge_method�
code_verifier�extra_credentials�
grant_type�redirect_uri�
refresh_token�
request_token�
response_typerX�scopes�state)
rg�user�token_type_hint�
response_mode�nonce�display�promptrb�max_age�
ui_locales�
id_token_hint�
login_hint�
acr_values)ru�http_methodr��headers�bodyr>�decoded_body�oauth_params�
validator_log�_paramsrar9r5�	uri_query)r�rur�r�r�r�rs     ` rr�zRequest.__init__Zs����F���#�;���!�+�.���*�6�'�-�R�+@�A����4�L��	�*�4�9�9�5���������!
��D�!
��d�!
�
��!
�
�T�	!
�

�D�!
�
�d�
!
�
$�T�!
�
�T�!
�
 ��!
�
�$�!
�
�D�!
�
�T�!
�
�T�!
�
�T�!
�
�T�!
� 
�d�!!
�"
�T�#!
�$��#�"�������!���A!
���D	
�����D��4�>�>�!:�;�<������D��!2�!2�!8�b�9�:rc�R�||jvr|j|St|��rK)r��AttributeError)r��names  r�__getattr__zRequest.__getattr__�s(���4�<�<���<�<��%�%� ��&�&rc��t�sy|j}|jj�}|rtjdt
|��}d|vrd|d<dj|j|j||�S)Nz<oauthlib.Request SANITIZED>z<SANITIZED>�
Authorizationz<SANITIZED>zF<oauthlib.Request url="{}", http_method="{}", headers="{}", body="{}">)
rr�r��copy�SANITIZE_PATTERN�subr�formatrur�)r�r�r�s   r�__repr__zRequest.__repr__�sv���{�1��y�y���,�,�#�#�%���#�'�'���T��C�D��g�%�'4�G�O�$�W�^�^��H�H�d�&�&���7�	7rc�T�tj|j�jSrK)r1rur3�r�s rr�zRequest.uri_query�s��� � ����*�0�0�0rc�b�|jsgStj|jdd��S)NT)r,�strict_parsing)r�r1r2r�s r�uri_query_paramszRequest.uri_query_params�s,���~�~��I��!�!�$�.�.�D�15�7�	7rc��tjt�}d�|jxsg|jzD�}|D]}||xxdz
cc<�|j�D��cgc]
\}}|dkDs�|��c}}Scc}}w)Nc3�&K�|]	}|d���y�w)rNrB)rM�ps  rrQz+Request.duplicate_params.<locals>.<genexpr>�s����P���a�D�P�s�r)�collections�defaultdictrEr�r�r;)r��	seen_keys�all_keysr%�cs     r�duplicate_paramszRequest.duplicate_params�s{���+�+�C�0�	�P�"�/�/�5�2��9N�9N�N�P���	�A��a�L�A��L�	�'�o�o�/�9�d�a��1�q�5��9�9��9s�%
A;�3A;)�GETNNr)r�r�r�r�r�r�r��propertyr�r�r�rBrrr�r�Ks]���CG�!�0;�d'�
7��1��1��7��7��:��:rr�)�/)F)r[)3r�r�r]�logging�rerF�urllib.parse�parser1rrrrrrrIr�secretsrr	�ImportError�randomr
�UNICODE_ASCII_CHARACTER_SET�CLIENT_ID_CHARACTER_SET�compile�
IGNORECASEr�r/�always_safe�	getLogger�logrr)r-r!r5r>rCrArUrhrlrnrrr|r�rcr9r�r�rBrr�<module>r�s<������	������=�.� ,��N���2�:�:�G����W�� �b�j�j�!J�K��"���g���
�#��
�
�*�	�	���
��$8� 9�
9�
�&�B�:9�	!��$?�	>��$?�!�(?�)�"�B��$�2!&�$�!&�He:�e:��k	�=�<�<�=�s�C � 
C0�/C0

Zerion Mini Shell 1.0