+
    Q?j-                    P   ^ RI Ht ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RI	H
t
 ^RIHt ^RIHtHtHt ^RIHtHt ]P(                  '       d   ^ RIHt . ROt ! R R	4      t ! R R]4      t ! R R
]4      t ! R R]4      t ! R R]4      t ! R R]P8                  4      tR# )    )annotationsN)	b64encode)parse_http_list)ProtocolError)CookiesRequestResponse)to_bytesto_str)_HashAuth	BasicAuth
DigestAuthFunctionAuth	NetRCAuthc                  F    ] tR t^tRtRtRtR R ltR R ltR R lt	R	t
R
# )r   a  
Base class for all authentication schemes.

To implement a custom authentication scheme, subclass `Auth` and override
the `.auth_flow()` method.

If the authentication scheme does I/O such as disk access or network calls, or uses
synchronization primitives such as locks, you should override `.sync_auth_flow()`
and/or `.async_auth_flow()` instead of `.auth_flow()` to provide specialized
implementations that will be used by `Client` and `AsyncClient` respectively.
Fc                    V ^8  d   QhRRRR/#    requestr   returnz)typing.Generator[Request, Response, None] )formats   "u/home/vela/workspace/domain/tn-silver/web/tn-site/.runtime/imagegen-venv/lib/python3.14/site-packages/httpx2/_auth.py__annotate__Auth.__annotate__&   s       -V     c              #     "   Vx  R# 5i)a  
Execute the authentication flow.

To dispatch a request, `yield` it:

```
yield request
```

The client will `.send()` the response back into the flow generator. You can
access it like so:

```
response = yield request
```

A `return` (or reaching the end of the generator) will result in the
client returning the last response obtained from the server.

You can dispatch as many requests as is necessary.
Nr   selfr   s   &&r   	auth_flowAuth.auth_flow&   s     , s   	c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   r   >   s      g 2[ r   c              #     "   V P                   '       d   VP                  4        V P                  V4      p\        V4      p Vx pV P                  '       d   VP                  4         VP                  V4      pK;    \         d     R# i ; i5i)z
Execute the authentication flow synchronously.

By default, this defers to `.auth_flow()`. You should override this method
when the authentication scheme does I/O and/or uses concurrency primitives.
N)requires_request_bodyreadr!   nextrequires_response_bodysendStopIterationr    r   flowresponses   &&  r   sync_auth_flowAuth.sync_auth_flow>   sv      %%%LLN~~g&t*$}H***))H-  s0   ABB)A< :B<BB
BBc                    V ^8  d   QhRRRR/# )r   r   r   r   z(typing.AsyncGenerator[Request, Response]r   )r   s   "r   r   r   U   s      W 9a r   c               J  "   V P                   '       d   VP                  4       G Rj  xL
  V P                  V4      p\        V4      p V5x pV P                  '       d   VP                  4       G Rj  xL
   VP                  V4      pKD   Ld L  \         d     R# i ; i5i)z
Execute the authentication flow asynchronously.

By default, this defers to `.auth_flow()`. You should override this method
when the authentication scheme does I/O and/or uses concurrency primitives.
N)r%   areadr!   r'   r(   r)   r*   r+   s   &&  r   async_auth_flowAuth.async_auth_flowU   s      %%%--/!!~~g&t*$}H***nn&&&))H- " ' ! sK   &B#B7B#!B#4B5B#:B B#B#B B#B  B#r   N)__name__
__module____qualname____firstlineno____doc__r%   r(   r!   r.   r3   __static_attributes__r   r   r   r   r      s)    
 ""0. r   c                  2    ] tR t^mtRtR R ltR R ltRtR# )r   z
Allows the 'auth' argument to be passed as a simple callable function,
that takes the request, and returns a new, modified request.
c                    V ^8  d   QhRRRR/# )r   funcz#typing.Callable[[Request], Request]r   Noner   )r   s   "r   r   FunctionAuth.__annotate__s   s      @ T r   c                	    Wn         R # N_func)r    r=   s   &&r   __init__FunctionAuth.__init__s   s    
r   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   r?   v   s     " " "-V "r   c              #  	4   "   V P                  V4      x  R # 5irA   rB   r   s   &&r   r!   FunctionAuth.auth_flowv   s     jj!!s   rB   N)r5   r6   r7   r8   r9   rD   r!   r:   r   r   r   r   r   m   s    
" "r   c                  >    ] tR t^ztRtR R ltR R ltR R ltRtR	# )
r   zm
Allows the 'auth' argument to be passed as a (username, password) pair,
and uses HTTP Basic authentication.
c               $    V ^8  d   QhRRRRRR/# r   usernamestr | bytespasswordr   r>   r   )r   s   "r   r   BasicAuth.__annotate__   s&     H H H H Hr   c                	2    V P                  W4      V n        R # rA   )_build_auth_header_auth_headerr    rL   rN   s   &&&r   rD   BasicAuth.__init__   s     33HGr   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   rO      s       -V r   c              #  	H   "   V P                   VP                  R &   Vx  R# 5i)AuthorizationN)rR   headersr   s   &&r   r!   BasicAuth.auth_flow   s     +/+<+<(s    "c               $    V ^8  d   QhRRRRRR/# r   rL   rM   rN   r   strr   )r   s   "r   r   rO      "        ;  +  RU  r   c                	    R P                  \        V4      \        V4      34      p\        V4      P                  4       pRV 2#    :zBasic joinr
   r   decoder    rL   rN   userpasstokens   &&&  r   rQ   BasicAuth._build_auth_header   ?    99hx0(82DEF(#**,wr   )rR   N	r5   r6   r7   r8   r9   rD   r!   rQ   r:   r   r   r   r   r   z   s    
H   r   c                  B    ] tR t^tRtR
R R lltR R ltR R ltR	tR# )r   zL
Use a 'netrc' file to lookup basic auth credentials based on the url host.
Nc                    V ^8  d   QhRRRR/# )r   filez
str | Noner   r>   r   )r   s   "r   r   NetRCAuth.__annotate__   s     - -Z -4 -r   c                	:    ^ RI pVP                  V4      V n        R# )r   N)netrc_netrc_info)r    rl   ro   s   && r   rD   NetRCAuth.__init__   s     	 ;;t,r   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   rm      s       -V r   c              #  	  "   V P                   P                  VP                  P                  4      pVe   V^,          '       g   Vx  R # V P	                  V^ ,          V^,          R7      VP
                  R&   Vx  R # 5i)N)rL   rN   rW   )rp   authenticatorsurlhostrQ   rX   )r    r   	auth_infos   && r   r!   NetRCAuth.auth_flow   sk     $$33GKK4D4DE	IaLLM 04/F/FPYZ[P\gpqrgs/F/tGOOO,Ms   AA?:A?c               $    V ^8  d   QhRRRRRR/# r[   r   )r   s   "r   r   rm      r]   r   c                	    R P                  \        V4      \        V4      34      p\        V4      P                  4       pRV 2# r_   ra   rd   s   &&&  r   rQ   NetRCAuth._build_auth_header   rh   r   )rp   rA   ri   r   r   r   r   r      s    -   r   c                  :   ] tR t^t$ R]P
                  R]P
                  R]P                  R]P                  R]P                  R]P                  R]P                  R]P                  /t	R	]
R
&   R R ltR R ltR R ltR R ltR R ltR R ltR R ltRtR# )r   MD5zMD5-SESSSHAzSHA-SESSzSHA-256zSHA-256-SESSzSHA-512zSHA-512-SESSz*dict[str, typing.Callable[[bytes], _Hash]]_ALGORITHM_TO_HASH_FUNCTIONc               $    V ^8  d   QhRRRRRR/# rK   r   )r   s   "r   r   DigestAuth.__annotate__   s!         r   c                	b    \        V4      V n        \        V4      V n        R V n        ^V n        R # rA   )r
   	_username	_password_last_challenge_nonce_countrS   s   &&&r   rD   DigestAuth.__init__   s*    !(+!(+<@r   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   r      s       -V r   c              #  	j  "   V P                   '       d)   V P                  WP                   4      VP                  R &   Vx pVP                  R8w  g   RVP                  9  d   R# VP                  P	                  R4       F*  pVP                  4       P                  R4      '       g   K*   M	  R# V P                  WV4      V n         ^V n        V P                  WP                   4      VP                  R &   VP                  '       d&   \        VP                  4      P                  VR7       Vx  R# 5i)rW   i  zwww-authenticateNzdigest r   )r   rQ   rX   status_codeget_listlower
startswith_parse_challenger   cookiesr   set_cookie_header)r    r   r-   auth_headers   &&  r   r!   DigestAuth.auth_flow   s     /3/F/FwPdPd/eGOOO, =3&*<HDTDT*T #++445GHK  "--i88 I #44WT+/+B+B7L`L`+a(H$$%777Hs   B#D3*B	D3c               (    V ^8  d   QhRRRRRRRR/# )	r   r   r   r-   r	   r   r\   r   _DigestAuthChallenger   )r   s   "r   r   r      s0     C C C8 CRU CZn Cr   c                N   VP                  R4      w  rEpVP                  4       R8X  g   Q h/ p\        V4       F8  pVP                  4       P	                  R^4      w  rV
P                  R4      Wy&   K:  	   VR,          P                  4       pVR,          P                  4       pVP                  RR4      pR	V9   d   VR	,          P                  4       MR
pRV9   d   VR,          P                  4       MR
p\        WWVR7      #   \         d   pRp\        TTR7      ThR
p?ii ; i)z
Returns a challenge from a Digest WWW-Authenticate header.
These take the form of:
`Digest realm="realm@host.com",qop="auth,auth-int",nonce="abc",opaque="xyz"`
 digest="realmnonce	algorithmr}   opaqueNqop)r   r   r   r   r   z(Malformed Digest WWW-Authenticate headerr   )
	partitionr   r   stripsplitencodegetr   KeyErrorr   )r    r   r-   r   scheme_fieldsheader_dictfieldkeyvaluer   r   r   r   r   excmessages   &&&&              r   r   DigestAuth._parse_challenge   s    (11#66 ||~)))&($V,E,,S!4JC${{3/K -		C(//1E(//1E#U;I7?;7N[*113TXF16+1E+e$++-4C'eIjmnn 	C@G9sB	Cs   6BD D$DD$c               $    V ^8  d   QhRRRRRR/# )r   r   r   	challenger   r   r\   r   )r   s   "r   r   r      s#     ,? ,?' ,?>R ,?WZ ,?r   c                	  a V P                   VP                  P                  4       ,          oR  V3R llpRP                  V P                  VP
                  V P                  34      pVP                  P                  pRP                  VP                  P                  4       V34      pV! V4      pRV P                  ,          pV P                  V P                  VP                  4      p	V ;P                  ^,          un        V! V4      p
VP                  P                  4       P                  R4      '       d$   V! RP                  WP                  V	34      4      p
V P!                  VP"                  VR7      pVf   WP                  V.pMWP                  WW.pRV P                  RVP
                  RVP                  R	VR
V! RP                  V4      4      RVP                  P                  4       /pVP$                  '       d   VP$                  VR&   V'       d   RVR&   WR&   WR&   RV P'                  V4      ,           # )c                    V ^8  d   QhRRRR/# )r   databytesr   r   )r   s   "r   r   3DigestAuth._build_auth_header.<locals>.__annotate__   s     	8 	8 	85 	8r   c                L   < S! V 4      P                  4       P                  4       # rA   )	hexdigestr   )r   	hash_funcs   &r   r   -DigestAuth._build_auth_header.<locals>.digest   s    T?,,.5577r   r`   s   %08xz-sessr   rL   r   r   urir-   r   r      authr   nccnoncezDigest )r   r   upperrb   r   r   r   ru   raw_pathmethodr   r   _get_client_noncer   r   endswith_resolve_qopr   r   _get_header_value)r    r   r   r   A1pathA2HA2nc_valuer   HA1r   digest_dataformat_argsr   s   &&&           @r   rQ   DigestAuth._build_auth_header   s   44Y5H5H5N5N5PQ		8 	8 YY	HI{{##YY--/67RjT...''(9(99??KQRj$$&//88C&#ABCC	w?;5K 3LK Y__Y__4tyy56,,335
 $-$4$4K!!(K ($*!411+>>>r   c               $    V ^8  d   QhRRRRRR/# )r   nonce_countintr   r   r   r   )r   s   "r   r   r     s!     9 9S 9 95 9r   c                	D   \        V4      P                  4       pW2,          pV\        P                  ! 4       P                  4       ,          pV\        P
                  ! ^4      ,          p\        P                  ! V4      P                  4       R,          P                  4       # )   :N   N)	r\   r   timectimeosurandomhashlibsha1r   )r    r   r   ss   &&& r   r   DigestAuth._get_client_nonce  sl    ##%	
	TZZ\  ""	RZZ]||A((*3/6688r   c                    V ^8  d   QhRRRR/# )r   header_fieldszdict[str, bytes]r   r\   r   )r   s   "r   r   r   '  s      /? C r   c                	    RpRpRpRp\        VP                  4       4       FC  w  pw  rxV^ 8  d
   VR,          pWr9  d   TMTp	WYP                  V\        V4      4      ,          pKE  	  V# )r   z{}="{}"z{}={} z, )r   r   r   )	enumerateitemsr   r   )
r    r   NON_QUOTED_FIELDSQUOTED_TEMPLATENON_QUOTED_TEMPLATEheader_valueir   r   templates
   &&        r   r   DigestAuth._get_header_value'  su    6#%!*=+>+>+@!AA~1u$*/*HNaHOOE6%=AAL	 "B r   c               $    V ^8  d   QhRRRRRR/# )r   r   bytes | Noner   r   r   r   )r   s   "r   r   r   5  s!     6 6 6w 6< 6r   c                	    Vf   R # \         P                  ! RV4      pRV9   d   R# VR.8X  d   \        R4      hRV: R2p\        WBR7      h)Ns   , ?r   s   auth-intz.Digest auth-int support is not yet implementedzUnexpected qop value "z" in digest authr   )rer   NotImplementedErrorr   )r    r   r   qopsr   s   &&&  r   r   DigestAuth._resolve_qop5  sT    ;xx$d?K= %&VWW*3'1ABG55r   )r   r   r   r   N)r5   r6   r7   r8   r   md5r   sha256sha512r   __annotations__rD   r!   r   rQ   r   r   r   r:   r   r   r   r   r      s    w{{GKKw||GLL7>>7>>	O!K 	6C6,?\96 6r   c                  J    ] tR tRt$ R]R&   R]R&   R]R&   R]R&   R]R	&   R
tR# )r   iC  r   r   r   r\   r   r   r   r   r   N)r5   r6   r7   r8   r   r:   r   r   r   r   r   C  s    LLN	r   r   )r   r   r   r   r   )
__future__r   r   r   r   r   typingbase64r   urllib.requestr   _exceptionsr   _modelsr   r   r	   _utilsr
   r   TYPE_CHECKINGr   __all__r   r   r   r   r   
NamedTupler   r   r   r   <module>r      s    "  	 	    * & / / $	 KT Tn
"4 
"   &   8W6 W6t6,, r   