Prv8 Shell
Server : Apache
System : Linux server.mata-lashes.com 3.10.0-1160.90.1.el7.x86_64 #1 SMP Thu May 4 15:21:22 UTC 2023 x86_64
User : matalashes ( 1004)
PHP Version : 8.1.29
Disable Function : NONE
Directory :  /usr/local/lib/python3.6/site-packages/oauthlib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/local/lib/python3.6/site-packages/oauthlib/__pycache__/common.cpython-36.pyc
3

F�KdA4�@s�dZddlZddlZddlZddlZddlZddljZddlm	Z
mZm
ZddlmZyddlmZmZWn$ek
r�ddlmZmZYnXdZd	Zejd
ej�Zejd�ZdZejd
�Zd9dd�Z	dd�Zdd�Z
dd�Z dd�Z!e"e�e"d�BZ#dd�Z$dd�Z%dd�Z&d d!�Z'd"efd#d$�Z(d%d&�Z)d'd(�Z*d"efd)d*�Z+d+d,�Z,d:d.d/�Z-d0d1�Z.d;d3d4�Z/Gd5d6�d6e0�Z1Gd7d8�d8�Z2dS)<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�getrandbitsZ>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789z_ !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}z&([^&;]*(?:password|token)[^=]*=)[^&;]+z&%[^0-9A-Fa-f]|%[0-9A-Fa-f][^0-9A-Fa-f]zAABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.-Zoauthlib�/cCs:t|t�r|jd�n|}t||�}t|t�r6|jd�}|S)Nzutf-8)�
isinstance�str�encode�_quote�bytes�decode)�s�safe�r�3/tmp/pip-build-8nxjc3nm/oauthlib/oauthlib/common.pyr+s



rcCs t|�}t|t�r|jd�}|S)Nzutf-8)�_unquoterrr)rrrrr5s

rcCs,t|�}t|�}t|t�r|S|jd�SdS)Nzutf-8)�encode_params_utf8�
_urlencoderrr)�paramsZutf8_params�
urlencodedrrrr?s

rcCsPg}xF|D]>\}}|jt|t�r*|jd�n|t|t�r@|jd�n|f�q
W|S)ziEnsures that all parameters in a list of 2-element tuples are encoded to
    bytestrings using UTF-8
    zutf-8)�appendrrr
)r�encoded�k�vrrrrHs rcCsPg}xF|D]>\}}|jt|t�r*|jd�n|t|t�r@|jd�n|f�q
W|S)zfEnsures that all parameters in a list of 2-element tuples are decoded to
    unicode using UTF-8.
    zutf-8)rrrr)r�decodedrrrrr�decode_params_utf8Ts rz=&;:%+~,*@!()/?'$cCsV|r.t|�tkr.d}t|t|�t|f��tj|�r@td��tj|dd�}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�errorrrrr�	urldecodecs

r)cCs�t|ttf�r6yt|�}Wq�tk
r2d}Yq�Xnnt|d�r�yt|�Wn.tk
rdd}Yq�tk
rzd}Yq�Xtt|t�r�|j	�n|�}t
|�}nd}|S)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__)rrrr)r"�hasattr�dict�	TypeError�list�itemsr)�rawrrrr�extract_params�s 


r1cCstttd��t��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
    �@)rr�generate_timestamprrrr�generate_nonce�sr4cCstttj���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�timerrrrr3�s	r3�cs$t��dj��fdd�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.
    �c3s|]}�j��VqdS)N)�choice)�.0�x)�chars�randrr�	<genexpr>�sz!generate_token.<locals>.<genexpr>)r�join�range)�lengthr<r)r<r=r�generate_token�srBcCsTddl}tjj�}|j|tj|jd�d�}|j|j�|j||d�}t	|d�}|S)Nr)�seconds)�scope�exp�RS256zUTF-8)
�jwt�datetime�utcnowrD�	timedeltaZ
expires_in�update�claimsr
�
to_unicode)Zprivate_pem�requestrG�nowrL�tokenrrr�generate_signed_token�s

rQcCsddl}|j||dgd�S)NrrF)Z
algorithms)rGr)Z
public_pemrPrGrrr�verify_signed_token�srRcCs
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.
    )rB)rAr<rrr�generate_client_id�srScCs2t|t�r|j�}tj|dd�}|j|�t|�S)z)Extend a query with a list of two-tuples.T)r )rr,r/r%r&�extendr)r'rZqueryparamsrrr�add_params_to_qs�s


rUFc	CsFtj|�\}}}}}}|r&t||�}n
t||�}tj||||||f�S)z5Add a list of two-tuples to the uri query components.)r%rU�
urlunparse)	�urir�fragmentZsch�net�path�parr'Zfrarrr�add_params_to_uri�s

r\cCsLt|�t|�krdSd}x*t||�D]\}}|t|�t|�AO}q$W|dkS)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�resultr;�yrrr�safe_string_equals�s	rd�UTF-8cs�t|t�r|St|t�r$t|�d�St|d�r�yt|�Wn4tk
rNYnFtk
rn�fdd�|D�SXt|d�r�|j�}�fdd�|D�S|S)z:Convert a number of different types of objects to unicode.)�encodingr*c3s|]}t|��VqdS)N)rM)r:�i)rfrrr>szto_unicode.<locals>.<genexpr>r/cs"i|]\}}t|��t|���qSr)rM)r:rr)rfrr�
<dictcomp>"szto_unicode.<locals>.<dictcomp>)rrrr+r,r-r"r/)�datarfr)rfrrMs



rMcsbeZdZdZiZdd�Zdd�Z�fdd�Z�fdd	�Zddd�Z	�fd
d�Z
�fdd�Z�ZS)�CaseInsensitiveDictz3Basic case insensitive dict with strings only keys.cCs.dd�|D�|_x|D]}||||<qWdS)NcSsi|]}||j��qSr)�lower)r:rrrrrh.sz0CaseInsensitiveDict.__init__.<locals>.<dictcomp>)�proxy)�selfrirrrr�__init__-s
zCaseInsensitiveDict.__init__cCs|j�|jkS)N)rkrl)rmrrrr�__contains__2sz CaseInsensitiveDict.__contains__cs*|j|j�}t�j|�|j|j�=dS)N)rlrk�super�__delitem__)rmr�key)�	__class__rrrq5szCaseInsensitiveDict.__delitem__cs|j|j�}t�j|�S)N)rlrkrp�__getitem__)rmrrr)rsrrrt:szCaseInsensitiveDict.__getitem__NcCs||kr||S|S)Nr)rmr�defaultrrr�get>szCaseInsensitiveDict.getcs t�j||�||j|j�<dS)N)rp�__setitem__rlrk)rmrr)rsrrrwAszCaseInsensitiveDict.__setitem__cs4t�j||�x t||�D]}||j|j�<qWdS)N)rprKr,rlrk)rm�args�kwargsr)rsrrrKEszCaseInsensitiveDict.update)N)
�__name__�
__module__�__qualname__�__doc__rlrnrorqrtrvrwrK�
__classcell__rr)rsrrj's
rjc@sNeZdZdZddd�Zdd�Zd	d
�Zedd��Zed
d��Z	edd��Z
dS)�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.
    �GETN�utf-8cs��fdd�}||�|_||�|_t||p*i��|_||�|_t|j�|_g|_i|_ddddddddddddddddddddddddddddddd�|_	|j	j
tt|j
���|j	j
t|jp�g��dS)Ncs�rt|��S|S)N)rM)r;)rfrr�<lambda>]sz"Request.__init__.<locals>.<lambda>)Zaccess_token�clientZ	client_idZ
client_secret�codeZcode_challengeZcode_challenge_methodZ
code_verifierZextra_credentialsZ
grant_typeZredirect_uriZ
refresh_tokenZ
request_tokenZ
response_typerDZscopes�staterP�userZtoken_type_hintZ
response_mode�nonce�display�promptrLZmax_ageZ
ui_localesZ
id_token_hintZ
login_hintZ
acr_values)rW�http_methodrj�headers�bodyr1�decoded_bodyZoauth_paramsZ
validator_log�_paramsrKr,r)�	uri_query)rmrWr�r�r�rfr
r)rfrrnZsP



zRequest.__init__cCs ||jkr|j|St|��dS)N)r��AttributeError)rm�namerrr�__getattr__�s

zRequest.__getattr__cCsRt�s
dS|j}|jj�}|r.tjdt|��}d|kr>d|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�formatrWr�)rmr�r�rrr�__repr__�s
zRequest.__repr__cCstj|j�jS)N)r%rWr')rmrrrr��szRequest.uri_querycCs|js
gStj|jddd�S)NT)r �strict_parsing)r�r%r&)rmrrr�uri_query_params�s
zRequest.uri_query_paramscCsTtjt�}dd�|jpg|jD�}x|D]}||d7<q*Wdd�|j�D�S)Ncss|]}|dVqdS)rNr)r:�prrrr>�sz+Request.duplicate_params.<locals>.<genexpr>rcSsg|]\}}|dkr|�qS)rr)r:r�crrr�
<listcomp>�sz,Request.duplicate_params.<locals>.<listcomp>)�collections�defaultdictr5r�r�r/)rmZ	seen_keysZall_keysrrrr�duplicate_params�s

zRequest.duplicate_params)r�NNr�)rzr{r|r}rnr�r��propertyr�r�r�rrrrrKs

1r)r
)F)re)3r}r�rH�logging�rer6�urllib.parse�parser%rrrrrrr8rZsecretsrr�ImportError�randomr	ZUNICODE_ASCII_CHARACTER_SETZCLIENT_ID_CHARACTER_SET�compile�
IGNORECASEr�r#Zalways_safe�	getLogger�logrrr!rr)r1r4r3rBrQrRrSrUr\rdrMr,rjrrrrr�<module>sL





	!		


$

haha - 2025