8f'dZddlZddlZddlZddlZddlZddlZddlmZddl m Z ddl m Z m Z mZddlmZddlmZd Zd Zd ZGd d ZGddeZGddeZGddeZdS)z] requests.auth ~~~~~~~~~~~~~ This module contains the authentication handlers for Requests. N) b64encode)to_native_string) basestringstrurlparse)extract_cookies_to_jar)parse_dict_headerz!application/x-www-form-urlencodedzmultipart/form-datac t|ts=tjd|t t |}t|tsJtjdt|t t |}t|t r|d}t|t r|d}dttd ||f z}|S)zReturns a Basic Auth string.zNon-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.)categoryzNon-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 :) isinstancerwarningswarnformatDeprecationWarningrtypeencoderrjoinstrip)usernamepasswordauthstrs y/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/pip/_vendor/requests/auth.py_basic_auth_strrs6 h + +!  x(('     x== h + +!  tH~~..'     x==(C  -??8,,(C  -??8,,)$))Xx0112288::G NceZdZdZdZdS)AuthBasez4Base class that all auth implementations derive fromc td)NzAuth hooks must be callable.)NotImplementedErrorselfrs r__call__zAuthBase.__call__Hs!"@AAArN__name__ __module__ __qualname____doc__r%rrrrEs.>>BBBBBrrc*eZdZdZdZdZdZdZdS) HTTPBasicAuthz?Attaches HTTP Basic Authentication to the given Request object.c"||_||_dSN)rrr#rrs r__init__zHTTPBasicAuth.__init__Os    rc t|jt|ddk|jt|ddkgSNrrallrgetattrrr#others r__eq__zHTTPBasicAuth.__eq__SE  D!A!AA  D!A!AA    rc||k Sr/r+r7s r__ne__zHTTPBasicAuth.__ne__[5=  rcJt|j|j|jd<|S)N Authorizationrrrheadersr"s rr%zHTTPBasicAuth.__call__^s!%4T]DM%R%R /"rN)r'r(r)r*r1r9r<r%r+rrr-r-LsVII!!!   !!!rr-ceZdZdZdZdS) HTTPProxyAuthz=Attaches HTTP Proxy Authentication to a given Request object.cJt|j|j|jd<|S)NzProxy-Authorizationr@r"s rr%zHTTPProxyAuth.__call__fs"+:4=$-+X+X '(rNr&r+rrrCrCcs)GGrrCcBeZdZdZdZdZdZdZdZdZ dZ d Z d S) HTTPDigestAuthz@Attaches HTTP Digest Authentication to the given Request object.cR||_||_tj|_dSr/)rr threadinglocal _thread_localr0s rr1zHTTPDigestAuth.__init__ns&    &_..rct|jdsJd|j_d|j_d|j_i|j_d|j_d|j_dSdS)NinitTr)hasattrrJrL last_nonce nonce_countchalpos num_401_calls)r#s rinit_per_thread_statez$HTTPDigestAuth.init_per_thread_statetsit)622 4&*D  #,.D  )-.D  *&(D  #%)D  "/3D  , , ,  4 4rc |jjd}|jjd}|jjd}|jjd}|jjd}d|d}n|}|dks|dkrd } | n#|d krd } | n|d krd } | n |dkrd} | fd} dSd}t |}|jpd}|jr |d|jz }|jd|d|j}|d|}|}|}||jj kr|jxj dz c_ n d|j_ |jj d}t|jj  d}|| dz }|tj dz }|tjdz }t#j|dd}|dkr|d|d|}|s| ||d|}n9|dksd|dvr|d|d|d|}| ||}ndS||j_ d|jd|d|d|d |d! }|r |d"|d!z }|r |d#|d!z }|r |d$|d!z }|r |d%|d&|d!z }d'|S)(z :rtype: str realmnonceqop algorithmopaqueNMD5zMD5-SESSct|tr|d}tj|SNutf-8)rrrhashlibmd5 hexdigestxs rmd5_utf8z4HTTPDigestAuth.build_digest_header..md5_utf8s?a%%*))A{1~~//111rSHAct|tr|d}tj|Sr])rrrr_sha1rarbs rsha_utf8z4HTTPDigestAuth.build_digest_header..sha_utf8s?a%%*))A|A00222rzSHA-256ct|tr|d}tj|Sr])rrrr_sha256rarbs r sha256_utf8z7HTTPDigestAuth.build_digest_header..sha256_utf8Aa%%*))A~a((22444rzSHA-512ct|tr|d}tj|Sr])rrrr_sha512rarbs r sha512_utf8z7HTTPDigestAuth.build_digest_header..sha512_utf8rlrc$|d|S)N:r+)sd hash_utf8s rz4HTTPDigestAuth.build_digest_header..s))qJJ1JJ//r/?rqr08xr^auth,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 )rJrQgetupperrpathqueryrrrOrPrrtimectimeosurandomr_rgrasplit)r#methodurlrVrWrXrYrZ _algorithmrdrhrkroKDentdigp_parsedrA1A2HA1HA2ncvaluerrcnoncerespdignoncebitbaserts @rbuild_digest_headerz"HTTPDigestAuth.build_digest_header~s5 "'0"'0 %))%00&+// << #(,,X66  JJ"**J   * ":": 2 2 2 !II 5  3 3 3 !II 9 $ $ 5 5 5 $II 9 $ $ 5 5 5 $I / / / /  4C==}# > ) ((( (D 7 7 7 7 7 7    immimm D&1 1 1   * *a / * * *-.D  *'399 ". / / 6 6w ? ? U\\' " "" TZ\\  ) )) RZ]]a**,,SbS1  # #)s55U55V5566C b....//GG F]]f #66??'??F??#??Hbh''GG4(-% 2 2 2% 2 25 2 2 2 2'. 2 2 2   + **** *D  1 0I000 0D  + **** *D  E DDD6DDD DDrc 0|jrd|j_dSdS)z)Reset num_401_calls counter on redirects.rN) is_redirectrJrS)r#r$kwargss rhandle_redirectzHTTPDigestAuth.handle_redirects' = 1/0D  , , , 1 1rc d|jcxkrdksnd|j_|S|jj)|jj|jj|jdd}d| vrA|jjdkr0|jxjdz c_tj d 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 iirNzwww-authenticaterMdigestzdigest )flags)countr?) status_coderJrSrRrequestbodyseekrAr~lowerrecompile IGNORECASEr subrQcontentclosecopyr _cookiesrawprepare_cookiesrrr connectionsendhistoryappend)r#r$rs_authpatprep_rs r handle_401zHTTPDigestAuth.handle_401sam))))c))))/0D  ,H   ! - IN   2 6 7 7 71266 v||~~ % %$*<*JQ*N*N   , , 1 , ,*Zr}===C&7FRS8T8T&U&UD  # II GGIII9>>##D "4=!)QU C C C   / / /,0,D,D TX--DL )#"422622B J  a BJI+,(rc||jjr(||j|j|jd< |j|j_ n#t$rd|j_ YnwxYw| d|j | d|j d|j_|S)Nr?responser)rTrJrOrrrrArtellrRAttributeError register_hookrrrSr"s rr%zHTTPDigestAuth.__call__s ""$$$   ( S)-)A)A!(AE)R)RAIo & *%&V[[]]D  " " * * * &*D  " " "  *  DO444  D$8999+,(s #A..BBc t|jt|ddk|jt|ddkgSr3r4r7s rr9zHTTPDigestAuth.__eq__1r:rc||k Sr/r+r7s rr<zHTTPDigestAuth.__ne__9r=rN) r'r(r)r*r1rTrrrr%r9r<r+rrrFrFksJJ/// 444l l l \111 ***X(   !!!!!rrF)r*r_rrrHrrbase64r_internal_utilsrcompatrrrcookiesr utilsr CONTENT_TYPE_FORM_URLENCODEDCONTENT_TYPE_MULTI_PARTrrr-rCrFr+rrrs  ----------------++++++$$$$$$B/)))XBBBBBBBBH.MO!O!O!O!O!XO!O!O!O!O!r