Re/dZddlZddlmZmZmZmZmZddl m Z m Z ddl m Z mZddlmZddlmZddlmZmZmZmZmZdd lmZeeZeeeefZ ddlan;#e $rdaYn2e!$r+Z"e#d ee"daYdZ"["ndZ"["wwxYwd eed eed eefdZ$Gdde Z%dS)zNetwork Authentication Helpers Contains interface (MultiDomainBasicAuth) and associated glue code for providing credentials in the context of network requests. N)AnyDictListOptionalTuple)AuthBase HTTPBasicAuth)RequestResponse)get_netrc_auth) getLogger)ask ask_input ask_passwordremove_auth_from_urlsplit_auth_netloc_from_url)AuthInfo*Keyring is skipped due to an exception: %surlusernamereturnc|rtsdS tj}td||||}||j|jfSdS#t $rYnwxYw|r6td|tj||}|r||fSnA#t$r4}t dt|daYd}~nd}~wwxYwdS)z3Return the tuple auth for a given url from keyring.Nz'Getting credentials from keyring for %sz$Getting password from keyring for %sr) keyringget_credentialloggerdebugrpasswordAttributeError get_password Exceptionwarningstr)rrrcredrexcs /builddir/build/BUILDROOT/alt-python311-pip-21.3.1-3.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_internal/network/auth.pyget_keyring_authr&(s, gt $3N LLBC H H H!>#x00D}dm334    D   * LL? E E E+C::H *))  8 HH     4s4 A6B A BA  :B C&*CCc DeZdZ ddedeeeddfdZdedeefdZ dd ed ed ede fd Z d ede eeeeeffdZ de de fdZdede eeeeeffdZdefdZdededefdZdededdfdZdededdfdZdS)MultiDomainBasicAuthTN prompting index_urlsrc>||_||_i|_d|_dS)N)r)r* passwords_credentials_to_save)selfr)r*s r%__init__zMultiDomainBasicAuth.__init__Js*#$.0 <@!!!rc|r|jsdS|jD]@}t|ddz}||r|cSAdS)aReturn the original index URL matching the requested URL. Cached or dynamically generated credentials may work against the original index URL rather than just the netloc. The provided url should have had its username and password removed already. If the original index url had credentials then they will be included in the return value. Returns None if no matching index was found, or if --no-index was specified by the user. N/)r*rrstrip startswith)r.ruprefixs r%_get_index_urlz#MultiDomainBasicAuth._get_index_urlWsr $/ 4  A)!,,33C883>F~~f%%  tr0F original_url allow_netrc allow_keyringcPt|\}}}|\}}||td||S||} | r2t| } | r!| \} } } td| | r.| d&| \}}||td|| S|r.t |} | rtd|| S|r?t | |pt ||}|rtd||S||fS)z2Find and return credentials for the specified URL.NzFound credentials in url for %szFound index url %srz%Found credentials in index url for %sz!Found credentials in netrc for %sz#Found credentials in keyring for %s)rrrr7r r&)r.r8r9r:rnetlocurl_user_passwordrr index_url index_info_index_url_user_password netrc_authkr_auths r%_get_new_credentialsz)MultiDomainBasicAuth._get_new_credentialsms*D * * &V& /(  H$8 LL:F C C C$ $'',,  >3I>>J >8B5 15 19===  /03?!8 Hh#(< DfMMM..  "' 55J " @&III!!  !H553 22    BFKKK!!r0ct|\}}}||\}}||%||jvr|j|\}}|||kr||}}|||pd}|pd}||f|j|<|||| Jd||||fS)a_Return the credentials to use for the provided URL. If allowed, netrc and keyring may be used to obtain the correct credentials. Returns (url_without_credentials, username, password). Note that even if the original URL contains credentials, this function may return a different username and password. Nz%Could not load credentials from url: )rrDr,) r.r8rr<r@rrunpws r%_get_url_and_credentialsz-MultiDomainBasicAuth._get_url_and_credentialss4LAAVQ"66|DD(   0f6N6N^F+FB8r>>%'(  8#7  ~2H~2H'/%9DN6 " !h&: X%5%5 A< A A&6%5%5Hh&&r0reqc||j\}}}||_||t|||}|d|j|S)Nresponse)rIrr register_hook handle_401)r.rJrrrs r%__call__zMultiDomainBasicAuth.__call__sj"&"?"?"H"HXx  H$83-(33C88C *do666 r0r<ctd|d}|sdSt||}|r!|d|d|d|ddfStd}||dfS) Nz User for z: )NNFrFz Password: T)rr&r)r.r<rauthrs r%_prompt_for_passwordz)MultiDomainBasicAuth._prompt_for_passwords333344 %$$11  +DG'DG,?7DGU* * --4''r0c@tsdStdddgdkS)NFz#Save credentials to keyring [y/N]: yn)rr)r.s r% _should_save_password_to_keyringz5MultiDomainBasicAuth._should_save_password_to_keyrings) 583*EELLr0respkwargsc |jdkr|S|js|Stj|j}||jdd\}}d}|s |s||j\}}}d|_ |8|6||f|j |j<|r#| r|j||f|_ |j |j t|pd|pd|j}|d|j|j r|d|j|jj|fi|}|j||S)NFT)r9r:rFrL) status_coder)urllibparseurlparserrDrSr<r-r,rWcontentraw release_connr requestrM warn_on_401save_credentials connectionsendhistoryappend) r.rXrYparsedrrsaverJnew_resps r%rNzMultiDomainBasicAuth.handle_401s  s " "K~ K&&tx00"66 H7  ( P P'+'@'@'O'O $Hh%)!  H$8-5x,@DN6= ) P==?? P-3]Hh,O)  >>>>> ?  ? ?++s(A!!$B B )TN)TF)__name__ __module__ __qualname__boolrrr"r/r7rrDrrIr rOrSrWr rrNrdrer0r%r(r(IsHL @ @ @2:492E @  @ @ @ @#(3-2!# 6"6"6"6" 6"  6"6"6"6"p.'.' sHSM8C=0 1.'.'.'.'`G" ( ( x}hsmT1 2 ( ( ( (M$MMMM 4x43484444lCD ?X ? ? ? ? ? ? ? ?r0r()&__doc__ urllib.parser]typingrrrrrpip._vendor.requests.authrr pip._vendor.requests.modelsr r pip._vendor.requests.utilsr pip._internal.utils.loggingr pip._internal.utils.miscrrrrr pip._internal.vcs.versioncontrolrrsrr" Credentialsr ImportErrorr r$r!r&r(rwr0r%rs 33333333333333========99999999555555111111655555 8  CcM"  NNNNGGG NN4 CGGGGGG (3-8C=XhEWBz?z?z?z?z?8z?z?z?z?z?sA!!B*B.!BB