AlkantarClanX12

Your IP : 3.145.115.139


Current Path : /opt/imunify360/venv/lib64/python3.11/site-packages/requests/__pycache__/
Upload File :
Current File : //opt/imunify360/venv/lib64/python3.11/site-packages/requests/__pycache__/auth.cpython-311.pyc

�

k��f�'���dZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
mZmZddl
mZddlmZddlmZd	Zd
Zd�ZGd�d
e��ZGd�de��ZGd�de��ZGd�de��ZdS)z]
requests.auth
~~~~~~~~~~~~~

This module contains the authentication handlers for Requests.
�N)�	b64encode�)�urlparse�str�
basestring)�extract_cookies_to_jar)�to_native_string)�parse_dict_headerz!application/x-www-form-urlencodedzmultipart/form-datac	��t|t��s=tjd�|��t
���t
|��}t|t��sJtjd�t|����t
���t
|��}t|t��r|�d��}t|t��r|�d��}dttd�||f���������z}|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�encoder	r�join�strip)�username�password�authstrs   �m/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/requests/auth.py�_basic_auth_strrs6���h�
�+�+�!��
�
���x�(�(�'�	
�	
�	
�	
��x�=�=���h�
�+�+�!��
�
���t�H�~�~�.�.�'�	
�	
�	
�	
��x�=�=���(�C� � �-��?�?�8�,�,���(�C� � �-��?�?�8�,�,���)��$�)�)�X�x�0�1�1�2�2�8�8�:�:����G��N�c��eZdZdZd�ZdS)�AuthBasez4Base class that all auth implementations derive fromc� �td���)NzAuth hooks must be callable.)�NotImplementedError��self�rs  r�__call__zAuthBase.__call__Ks��!�"@�A�A�ArN��__name__�
__module__�__qualname__�__doc__r%�rrrrHs.������>�>�B�B�B�B�Brrc�*�eZdZdZd�Zd�Zd�Zd�ZdS)�
HTTPBasicAuthz?Attaches HTTP Basic Authentication to the given Request object.c�"�||_||_dS�N)rr�r#rrs   r�__init__zHTTPBasicAuth.__init__Rs�� ��
� ��
�
�
rc	��t|jt|dd��k|jt|dd��kg��S�Nrr��allr�getattrr�r#�others  r�__eq__zHTTPBasicAuth.__eq__V�E����M�W�U�J��=�=�=��M�W�U�J��=�=�=�
���	rc��||kSr/r+r7s  r�__ne__zHTTPBasicAuth.__ne__\����5�=� � rc�J�t|j|j��|jd<|S)N�
Authorization�rrr�headersr"s  rr%zHTTPBasicAuth.__call___s!��%4�T�]�D�M�%R�%R��	�/�"��rN)r'r(r)r*r1r9r<r%r+rrr-r-OsV������I�I�!�!�!����!�!�!�����rr-c��eZdZdZd�ZdS)�
HTTPProxyAuthz=Attaches HTTP Proxy Authentication to a given Request object.c�J�t|j|j��|jd<|S)NzProxy-Authorizationr@r"s  rr%zHTTPProxyAuth.__call__gs"��+:�4�=�$�-�+X�+X��	�'�(��rNr&r+rrrCrCds)������G�G�����rrCc�B�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
S)�HTTPDigestAuthz@Attaches HTTP Digest Authentication to the given Request object.c�R�||_||_tj��|_dSr/)rr�	threading�local�
_thread_localr0s   rr1zHTTPDigestAuth.__init__os&�� ��
� ��
�&�_�.�.����rc���t|jd��sJd|j_d|j_d|j_i|j_d|j_d|j_dSdS)N�initT�r)�hasattrrJrL�
last_nonce�nonce_count�chal�pos�
num_401_calls)r#s r�init_per_thread_statez$HTTPDigestAuth.init_per_thread_stateusi���t�)�6�2�2�	4�&*�D��#�,.�D��)�-.�D��*�&(�D��#�%)�D��"�/3�D��,�,�,�
	4�	4rc����|jjd}|jjd}|jj�d��}|jj�d��}|jj�d��}d�|�d}n|���}|dks|dkrd	�}	|	�n#|d
krd�}
|
�n|dkrd
�}|�n|dkrd�}|��fd�}
��dSd}t	|��}|jpd}|jr
|d|jzz
}|j�d|�d|j��}|�d|��}�|��}�|��}||jj	kr|jxj
dz
c_
nd|j_
d|jj
z}t|jj
���d��}||�d��z
}|tj���d��z
}|tjd��z
}t#j|�����dd�}|dkr�|�d|�d|����}|s|
||�d|����}n<|dksd|�d��vr|�d|�d|�dd�d|��	}|
||��}ndS||j_	d|j�d|�d|�d|�d|�d �}|r|d!|zz
}|r|d"|zz
}|r|d#|zz
}|r|d$|�d%|�d �z
}d&|zS)'z
        :rtype: str
        �realm�nonce�qop�	algorithm�opaqueN�MD5zMD5-SESSc��t|t��r|�d��}tj|�����S�N�utf-8)rrr�hashlib�md5�	hexdigest��xs r�md5_utf8z4HTTPDigestAuth.build_digest_header.<locals>.md5_utf8�s?���a��%�%�*�����)�)�A��{�1�~�~�/�/�1�1�1r�SHAc��t|t��r|�d��}tj|�����Sr])rrrr_�sha1rarbs r�sha_utf8z4HTTPDigestAuth.build_digest_header.<locals>.sha_utf8�s?���a��%�%�*�����)�)�A��|�A���0�0�2�2�2rzSHA-256c��t|t��r|�d��}tj|�����Sr])rrrr_�sha256rarbs r�sha256_utf8z7HTTPDigestAuth.build_digest_header.<locals>.sha256_utf8��A���a��%�%�*�����)�)�A��~�a�(�(�2�2�4�4�4rzSHA-512c��t|t��r|�d��}tj|�����Sr])rrrr_�sha512rarbs r�sha512_utf8z7HTTPDigestAuth.build_digest_header.<locals>.sha512_utf8�rlrc�$���|�d|����S)N�:r+)�s�d�	hash_utf8s  �r�<lambda>z4HTTPDigestAuth.build_digest_header.<locals>.<lambda>�s���)�)�q�q�q�!�!�$4�5�5�r�/�?rqrz%08xr^���auth�,z
username="z
", realm="z
", nonce="z", uri="z
", response="�"z
, opaque="%s"z, algorithm="%s"z
, digest="%s"z, qop="auth", nc=z
, cnonce="z	Digest %s)rJrQ�get�upperr�path�queryrrrOrPrr�time�ctime�os�urandomr_rgra�split)r#�method�urlrVrWrXrYrZ�
_algorithmrdrhrkro�KD�entdig�p_parsedr�A1�A2�HA1�HA2�ncvaluerr�cnonce�respdig�noncebit�baserts                           @r�build_digest_headerz"HTTPDigestAuth.build_digest_headers����
�"�'��0���"�'��0��� �%�)�)�%�0�0���&�+�/�/��<�<�	��#�(�,�,�X�6�6���	����J�J�"���*�*�J�����*�
�":�":�
2�
2�
2�!�I�I�
�5�
 �
 �
3�
3�
3�!�I�I�
�9�
$�
$�
5�
5�
5�$�I�I�
�9�
$�
$�
5�
5�
5�$�I�
5�
5�
5�
5�����4����C�=�=���}�#����>�	)��C�(�.�(�(�D��=�=�=�%�%�%����
?�������
%���i��m�m���i��m�m���D�&�1�1�1���*�*�a�/�*�*�*�-.�D��*��4�-�9�9����"�.�/�/�6�6�w�?�?��	�U�\�\�'�
"�
"�"��	�T�Z�\�\�
 �
 ��
)�
)�)��	�R�Z��]�]����,�q�/�/�+�+�-�-�c�r�c�2����#�#��)�#�#�#�u�u�u�f�f�=�>�>�C��		��b�������4�5�5�G�G�
�F�]�]�f��	�	�#���6�6����w�w�w����������H��b��h�'�'�G�G��4�(-���%�%�#'�-�-�-�������t�t�t�W�W�W�N���	-��O�f�,�,�D��	3��&��2�2�D��	-��O�f�,�,�D��	K��D�'�'�'�6�6�6�J�J�D��d�#�#rc�0�|jrd|j_dSdS)z)Reset num_401_calls counter on redirects.rN)�is_redirectrJrS)r#r$�kwargss   r�handle_redirectzHTTPDigestAuth.handle_redirect�s'���=�	1�/0�D��,�,�,�	1�	1rc��d|jcxkrdksnd|j_|S|jj�)|jj�|jj��|j�dd��}d|�	��v�rA|jjdk�r0|jxjdz
c_tjd	tj�
��}t|�d|d�����|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-authenticaterM�digest�zdigest )�flags)�countr?)�status_coderJrSrR�request�body�seekrAr}�lower�re�compile�
IGNORECASEr
�subrQ�content�close�copyr�_cookies�raw�prepare_cookiesr�r�r��
connection�send�history�append)r#r$r��s_auth�pat�prep�_rs       r�
handle_401zHTTPDigestAuth.handle_401�s����a�m�)�)�)�)�c�)�)�)�)�/0�D��,��H���!�-�
�I�N���� 2� 6�7�7�7�����1�2�6�6���v�|�|�~�~�%�%�$�*<�*J�Q�*N�*N���,�,��1�,�,��*�Z�r�}�=�=�=�C�&7�����F�RS��8T�8T�&U�&U�D��#�
�I�I�
�G�G�I�I�I��9�>�>�#�#�D�"�4�=�!�)�Q�U�C�C�C�� � ���/�/�/�,0�,D�,D���T�X�-'�-'�D�L��)�"���"�4�2�2�6�2�2�B��J���a� � � ��B�J��I�+,���(��rc��|���|jjr(|�|j|j��|jd<	|j���|j_	n#t$rd|j_	YnwxYw|�d|j��|�d|j
��d|j_|S)Nr?�responser)rTrJrOr�r�r�rAr��tellrR�AttributeError�
register_hookr�r�rSr"s  rr%zHTTPDigestAuth.__call__s����"�"�$�$�$���(�	S�)-�)A�)A�!�(�A�E�)R�)R�A�I�o�&�	*�%&�V�[�[�]�]�D��"�"���	*�	*�	*�
&*�D��"�"�"�	*����	
���
�D�O�4�4�4�	���
�D�$8�9�9�9�+,���(��s�
#A.�.B�Bc	��t|jt|dd��k|jt|dd��kg��Sr3r4r7s  rr9zHTTPDigestAuth.__eq__*r:rc��||kSr/r+r7s  rr<zHTTPDigestAuth.__ne__0r=rN)r'r(r)r*r1rTr�r�r�r%r9r<r+rrrFrFls�������J�J�/�/�/�4�4�4�d$�d$�d$�L1�1�1�
*�*�*�X���(���!�!�!�!�!rrF)r*r�r�r�r_rHr�base64r�compatrrr�cookiesr�_internal_utilsr	�utilsr
�CONTENT_TYPE_FORM_URLENCODED�CONTENT_TYPE_MULTI_PARTr�objectrr-rCrFr+rr�<module>r�s�����
�	�	�	�	�	�	�	�����������������������-�-�-�-�-�-�-�-�-�-�+�+�+�+�+�+�-�-�-�-�-�-�$�$�$�$�$�$�B��/��)�)�)�XB�B�B�B�B�v�B�B�B������H����*�����M����E!�E!�E!�E!�E!�X�E!�E!�E!�E!�E!r