HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/requests/__pycache__/auth.cpython-310.pyc
o

�N�g�'�@s�dZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZm
Z
mZddlmZddlmZd	Zd
Zdd�ZGd
d�d�ZGdd�de�ZGdd�de�ZGdd�de�ZdS)z]
requests.auth
~~~~~~~~~~~~~

This module contains the authentication handlers for Requests.
�N)�	b64encode�)�to_native_string)�
basestring�str�urlparse)�extract_cookies_to_jar)�parse_dict_headerz!application/x-www-form-urlencodedzmultipart/form-datacCs�t|t�stjd�|�td�t|�}t|t�s(tjd�t|��td�t|�}t|t�r2|�d�}t|t�r<|�d�}dt	t
d�||f�����}|S)zReturns a Basic Auth string.z�Non-string usernames will no longer be supported in Requests 3.0.0. Please convert the object you've passed in ({!r}) to a string or bytes object in the near future to avoid problems.)�categoryz�Non-string passwords will no longer be supported in Requests 3.0.0. Please convert the object you've passed in ({!r}) to a string or bytes object in the near future to avoid problems.�latin1zBasic �:)
�
isinstancer�warnings�warn�format�DeprecationWarningr�type�encoderr�join�strip)�username�passwordZauthstr�r�A/opt/saltstack/salt/lib/python3.10/site-packages/requests/auth.py�_basic_auth_strs,

�

�



�rc@�eZdZdZdd�ZdS)�AuthBasez4Base class that all auth implementations derive fromcCstd��)NzAuth hooks must be callable.)�NotImplementedError��self�rrrr�__call__HszAuthBase.__call__N��__name__�
__module__�__qualname__�__doc__r!rrrrrE�rc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�
HTTPBasicAuthz?Attaches HTTP Basic Authentication to the given Request object.cCs||_||_dS�N)rr�rrrrrr�__init__Os
zHTTPBasicAuth.__init__cC�(t|jt|dd�k|jt|dd�kg�S�Nrr��allr�getattrr�r�otherrrr�__eq__S�
��zHTTPBasicAuth.__eq__cC�
||kSr)rr1rrr�__ne__[�
zHTTPBasicAuth.__ne__cC�t|j|j�|jd<|S)N�
Authorization�rrr�headersrrrrr!^�zHTTPBasicAuth.__call__N)r#r$r%r&r+r3r6r!rrrrr(Lsr(c@r)�
HTTPProxyAuthz=Attaches HTTP Proxy Authentication to a given Request object.cCr8)NzProxy-Authorizationr:rrrrr!fr<zHTTPProxyAuth.__call__Nr"rrrrr=cr'r=c@sPeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�ZdS)�HTTPDigestAuthz@Attaches HTTP Digest Authentication to the given Request object.cCs||_||_t��|_dSr))rr�	threading�local�
_thread_localr*rrrr+nszHTTPDigestAuth.__init__cCsDt|jd�s d|j_d|j_d|j_i|j_d|j_d|j_dSdS)N�initT�r)�hasattrrArB�
last_nonce�nonce_count�chal�pos�
num_401_calls)rrrr�init_per_thread_statets�z$HTTPDigestAuth.init_per_thread_statecs�|jjd}|jjd}|jj�d�}|jj�d�}|jj�d�}d�|dur*d}n|��}|dks6|dkr=d	d
�}	|	�n |dkrHdd
�}
|
�n|dkrSdd�}|�n
|dkr]dd�}|��fdd�}
�duridSd}t|�}|jpsd}|jr|d|j��7}|j�d|�d|j��}|�d|��}�|�}�|�}||jj	kr�|jj
d7_
nd|j_
|jj
d�}t|jj
��d�}||�d�7}|t
���d�7}|t�d�7}t�|���dd�}|dkr�|�d|�d|���}|s�|
||�d|���}n"|dk�sd|�d�v�r|�d|�d|�d |��}|
||�}ndS||j_	d!|j�d"|�d#|�d$|�d%|�d&�}|�r?|d'|�d&�7}|�rJ|d(|�d&�7}|�rU|d)|�d&�7}|�rc|d*|�d+|�d&�7}d,|��S)-z
        :rtype: str
        �realm�nonce�qop�	algorithm�opaqueN�MD5zMD5-SESScS�"t|t�r
|�d�}t�|���S�N�utf-8)r
rr�hashlib�md5�	hexdigest��xrrr�md5_utf8��

z4HTTPDigestAuth.build_digest_header.<locals>.md5_utf8ZSHAcSrQrR)r
rrrT�sha1rVrWrrr�sha_utf8�rZz4HTTPDigestAuth.build_digest_header.<locals>.sha_utf8zSHA-256cSrQrR)r
rrrT�sha256rVrWrrr�sha256_utf8�rZz7HTTPDigestAuth.build_digest_header.<locals>.sha256_utf8zSHA-512cSrQrR)r
rrrT�sha512rVrWrrr�sha512_utf8�rZz7HTTPDigestAuth.build_digest_header.<locals>.sha512_utf8cs�|�d|���S)N�:r)�s�d�Z	hash_utf8rr�<lambda>�sz4HTTPDigestAuth.build_digest_header.<locals>.<lambda>�/�?rarZ08xrS��Zauth�,z:auth:z
username="z
", realm="z
", nonce="z", uri="z
", response="�"z
, opaque="z
, algorithm="z
, digest="z, qop="auth", nc=z
, cnonce="zDigest )rArG�get�upperr�path�queryrrrErFrr�time�ctime�os�urandomrTr[rV�split)r�method�urlrKrLrMrNrOZ
_algorithmrYr\r^r`ZKDZentdigZp_parsedrnZA1ZA2ZHA1ZHA2ZncvaluerbZcnonceZrespdigZnoncebit�baserrdr�build_digest_header~s�
���
z"HTTPDigestAuth.build_digest_headercKs|jr	d|j_dSdS)z)Reset num_401_calls counter on redirects.rN)Zis_redirectrArI)rr �kwargsrrr�handle_redirect�s�zHTTPDigestAuth.handle_redirectcKs"d|jkrdksnd|j_|S|jjdur!|jj�|jj�|j�dd�}d|�	�vr�|jjdkr�|jjd7_t
jd	t
jd
�}t
|jd|dd��|j_|j|��|j��}t|j|j|j�|�|j�|�|j|j�|jd<|jj|fi|��}|j�|�||_|Sd|j_|S)
zo
        Takes the given response and tries digest-auth, if needed.

        :rtype: requests.Response
        i�i�rNzwww-authenticaterC�digest�zdigest )�flags)�countr9)Zstatus_coderArIrH�request�body�seekr;rl�lower�re�compile�
IGNORECASEr	�subrG�content�close�copyrZ_cookies�rawZprepare_cookiesrxrurv�
connection�send�history�append)rr ryZs_auth�patZprepZ_rrrr�
handle_401�s0	

�zHTTPDigestAuth.handle_401cCs||��|jjr|�|j|j�|jd<z	|j��|j_	Wn
t
y)d|j_	Ynw|�d|j�|�d|j
�d|j_|S)Nr9�responser)rJrArErxrurvr;r��tellrH�AttributeErrorZ
register_hookr�rzrIrrrrr!s�zHTTPDigestAuth.__call__cCr,r-r.r1rrrr31r4zHTTPDigestAuth.__eq__cCr5r)rr1rrrr69r7zHTTPDigestAuth.__ne__N)r#r$r%r&r+rJrxrzr�r!r3r6rrrrr>ks
n,r>)r&rTrrr�r?rpr�base64rZ_internal_utilsr�compatrrrZcookiesr�utilsr	ZCONTENT_TYPE_FORM_URLENCODEDZCONTENT_TYPE_MULTI_PARTrrr(r=r>rrrr�<module>s&,