+
    3jX*                        ^ 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	t	^ RI
Ht ^ RIHt ^ RIHt ^ RIHt ^ R	IHt ^ R
IHt ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RIHt ] P:                  ! ]4      tR/R R llt R R lt!R R lt"R R lt#R/R R llt$R/R R llt%R/R R llt&R R lt'R/R  R! llt(R" R# lt)R/R$ R% llt*R0R& R' llt+R1R(R/R) R* lllt,R/R(R/R+ R, lllt-R/R- R. llt.R# )2    N)Optional)Union)	urlencode)__version__)
BaseClient)AnacondaAuthConfig)AnacondaAuthSite)DeviceCodeFlow)AuthenticationError)DeviceFlowError)TokenNotFoundError)capture_auth_code)	TokenInfo)consolec                ^    V ^8  d   QhR\         R\         R\        \        ,          R\         /# )   code_challengestateconfigreturnstrr   r	   )formats   "5lib/python3.14/site-packages/anaconda_auth/actions.py__annotate__r      s2       #-56F-G    c           
         Vf   \        4       pVP                  P                  pVP                  pVP                  p\        VRRVVV RR7      p\        V4      pV RV 2pV# )z)Build the authorization code request URL.codez#openid email profile offline_accessS256)	client_idresponse_typescoper   redirect_urir   code_challenge_method?)r   oidcauthorization_endpointr    r#   dictr   )	r   r   r   r'   r    r#   paramsencoded_paramsurls	   &&&      r   make_auth_code_request_urlr,      sy    
 ~#%#[[??  I&&L3!%$F v&N#$An%5
6CJr   c                @    V ^8  d   QhR\         R\         R\        RR/# )r   r   r   r   r   Nr   r	   )r   s   "r   r   r   5   s,       #-=	r   c                J    \        WV4      p\        P                  ! V4       R# )z,Open the authentication flow in the browser.N)r,   
webbrowseropen)r   r   r   r+   s   &&& r   _send_auth_code_requestr2   5   s     %^F
CCOOCr   c                <    V ^8  d   QhR\         R\        R\         /# )r   refresh_tokenr   r   r.   )r   s   "r   r   r   =   s"       5E # r   c           	         \        VR7      pVP                  VP                  P                  RRRV RVP                  /RR7      pVP                  4        VP                  4       pVR,          pV# )zRefresh and save the tokens.site
grant_typer4   r    Fdataauthaccess_token)r   postr&   token_endpointr    raise_for_statusjson)r4   r   clientresponseresponse_datar<   s   &&    r   refresh_access_tokenrD   =   st    V$F{{""/]))

   H MMOM 0Lr   c                H    V ^8  d   QhR\         R\         R\        R\         /# )r   	auth_codecode_verifierr   r   r.   )r   s   "r   r   r   P   s,      #&0@r   c                l   VP                   P                  pVP                  pVP                  p\	        VR7      pVP                  V\        RVV VVR7      RR7      pVP                  4       pRV9   d0   \        RVP                  R4       RVP                  R	4       24      hVP                  R
4      p	V	# )zPRequest an access token using the provided authorization code and code verifier.r6   authorization_code)r8   r    r   r#   rG   Fr9   errorzError getting JWT: z - error_descriptionr<   )
r&   r>   r    r#   r   r=   r(   r@   r   get)
rF   rG   r   r>   r    r#   rA   rB   resultr<   s
   &&&       r   request_access_tokenrN   P   s     [[//N  I&&LV$F{{+%'
   
H ]]_F&!!&**W"5!6c&**EX:Y9Z[
 	
 ::n-Lr   c                F    V ^8  d   QhR\         \        ,          R\        /# r   r   r   r   r	   r   )r   s   "r   r   r   o   s      . .H%56 .# .r   c                   T ;'       g    \        4       p \        V R7      pVP                  4       p\        P                  ! R4       \        P                  ! R4       \        P                  ! 4        \        P                  ! VP
                  4       \        P                  ! 4        \        P                  ! R4       \        P                  ! 4        \        P                  ! VP                  4       \        P                  ! 4         \        P                  ! VP                  4       \        P                  ! R4      p VP                  4        VP                  4       pVP                  4        \        P                  ! R4       VR,          #   \         d     Lsi ; i  \         d    TP                  4        h \          d    TP                  4        h i ; i)z'Login using OAuth 2.0 device code flow.r   zPAttempting to automatically open the authorization page in your default browser.zuIf the browser does not open or you wish to use a different device to authorize this request, open the following URL:zThen enter the code:z,Waiting for authorization (CTRL-C to cancel)u   ✓ Login successful!r<   )r   r
   initiate_device_authorizationr   printverification_uri	user_coder0   r1   verification_uri_complete	Exceptionstatusstartpoll_for_tokenstopKeyboardInterruptr   )r   device_flowdevice_authorizationrZ   token_responses   &    r   _do_device_flowrb   o   sU   ++)+F !/K 'DDF MMZ MM MMOMM&778MMOMM()MMOMM&001MMO,FFG ^^JKF$335-.n--     s%    F ?AF FF$GGc                F    V ^8  d   QhR\         \        ,          R\        /# rP   rQ   )r   s   "r   r   r      s$     B B(#34 B Br   c                    T ;'       g    \        4       p \        \        P                  ! 4       4      p\        P
                  ! ^R7      w  r#\        W1V 4       \        V P                  WR7      p\        P                  R4       \        WBV 4      # )zZDo the browser-based auth flow and return the short-lived access_token and id_token tuple.)code_verifier_length)r   r   z-Authentication successful! Getting JWT token.)r   r   uuiduuid4pkcegenerate_pkce_pairr2   r   r#   loggerdebugrN   )r   r   rG   r   rF   s   &    r   _do_auth_flowrl      sq    ++)+F

E$($;$;QT$U!MN6: "&"5"5URI
LL@A  	&AAr   c                F    V ^8  d   QhR\         \        ,          R\        /# rP   rQ   )r   s   "r   r   r      s       *:!; s r   c           	     ~   \         P                  ! R\        ^ R7       V f   \        4       p \        P
                  ! R4      p\        P
                  ! RRR7      p\        V R7      pVP                  V P                  P                  RR	R
VR	V/RR7      pVP                  4       pVP                  4        VR,          pV# )zIPrompt for username and password and log in with the password grant flow.zKBasic login with username/password is deprecated and will be disabled soon.)
stacklevelzPlease enter your email: zPlease enter your password: T)passwordr6   r8   rp   usernameFr9   r<   )warningswarnUserWarningr   r   inputr   r=   r&   r>   r@   r?   )r   rq   rp   rA   rB   rC   r<   s   &      r   _login_with_usernamerv      s    MMU ~#%}}89H}};dKHV$F{{""*

   H MMOM 0Lr   c                4    V ^8  d   QhR\         R\        RR/# )r   r   basicr   Nr	   bool)r   s   "r   r   r      s"      & t  r   c                     V'       d   \        V R 7      pM+V P                  '       d   \        V R 7      pM\        V R 7      p\	        VV R 7      p\        W0P                  R7      pVP                  4        R# )rS   )api_keydomainN)rv   use_device_flowrb   rl   get_api_keyr   r}   save)r   rx   r<   r|   
token_infos   &&   r   	_do_loginr      sY    +6:				&f5$F3G
 7==AJOOr   c                R    V ^8  d   QhR\         R\        \        ,          R\         /# )r   r<   r   r   r   )r   s   "r   r   r      s,     !& !&!&%&!& 	!&r   c           	         T;'       g    \        4       p\        VR 7      pRRV  2/pVP                  pVe   WCR&   RVP                   R2RVP                   R2.pV F@  pVP                  V\        . ROR\         2.R7      VR	R
7      pVP                  ^8X  g   K@   M	  \        P                  ! R4       \        hVP                  4       R,          # )r6   AuthorizationzBearer zX-AAU-CLIENTzhttps://z/api/auth/api-keysz/api/iam/api-keyszanaconda-auth/v)scopestagsF)r@   headersr;   zError retrieving an API keyr|   )z
cloud:readzcloud:writez	repo:read)r   r   	aau_tokenauth_domainr}   r=   r(   r   status_coder   rU   r   r@   )r<   r   rA   r   r   urlsr+   rB   s   &&      r   r   r      s     ++)+FV$F', 89G  I"+ 6%%&&89
6==/!23D ;;A'}56   
 3&  	34!!==?9%%r   c                0    V ^8  d   QhR\         R\        /# rP   ry   )r   s   "r   r   r     s      . 4 r   c                      \         P                  ! V P                  4      P                  '       * pV#   \         d    R p T# i ; i)F)r   loadr}   expiredr   )r   valids   & r   _api_key_is_validr     sD    NN6==1999 L  Ls   /3 AAc                h    V ^8  d   QhR\         \        \        \        3,          ,          R\        /# r   r7   r   r   r   r   r	   )r   s   "r   r   r     s,      
5../
0r   c                 z    \        V \        4      '       d   T pV# V '       d   \        V R 7      pV# \        4       pV# )r6   )
isinstancer	   r   r7   r   s   & r   _get_configr     sC     $()) M 
#. M $%Mr   c                    V ^8  d   QhR\         \        \        \        3,          ,          R\         \        ,          R\        /# )r   r7   r   r   r   )r   s   "r   r   r     s<     ! !
5../
0!%&! !r   c                     V'       d   V e   \        R4      hV'       d   \        P                  ! R\        4       V# \	        V 4      # )Nz/You cannot set both site= and config= argumentszRThe config= keyword argument is deprecated, please use site=str | AnacondaAuthSite)
ValueErrorrr   rs   DeprecationWarningr   r   s   &&r   _site_or_configr     s?     $"JKK`	
 4  r   r   c                    V ^8  d   QhR\         \        \        \        3,          ,          R\         \        \        \        3,          ,          R\        R\        R\         \        ,          RR/# )r   r7   
ssl_verifyrx   forcer   r   Nr   r   r   r	   rz   )r   s   "r   r   r   -  sh     3 3
5../
03tSy)*3 3 	3 %&3 
3r   c                   \        WR7      pVe   VP                  RV/RR7      pV'       g   \        VR7      '       g   \        WRR7       R# R# )zJLog into Anaconda Platform and store the token information in the keyring.r   Nr   T)updatedeeprS   )r   rx   )r   
model_copyr   r   )r7   r   rx   r   r   site_configs   &&&&$ r   loginr   -  sP     "t;K!,, *-D - 
 %[992 :r   c                    V ^8  d   QhR\         \        \        \        3,          ,          R\         \        ,          RR/# )r   r7   r   r   Nr   )r   s   "r   r   r   A  s>      
5../
0 %& 
	r   c               >   \        WR7      p \        P                  ! VP                  R7      pVP	                  4        VP                  R8w  d   R#  \        P                  ! RR7      pVP	                  4        R#   \
         d     LJi ; i  \
         d     R# i ; i)zLog out of Anaconda Platform.r   r}   zanaconda.comNzanaconda.cloud)r   r   r   r}   deleter   )r7   r   r   r   s   &$  r   logoutr   A  s     "t;K^^;+=+=>
 ^+ 	^^+;<
    s#   1A< 'B <B
	B
BBc                h    V ^8  d   QhR\         \        \        \        3,          ,          R\        /# r   r   )r   s   "r   r   r   _  s*     " "xc+;&; <= " "r   c                     \        V \        4      '       d   T pM\        V R 7      p \        P                  ! VP
                  R7      pVRJ#   \         d	    Rp TRJ# i ; i)r6   r   N)r   r	   r   r   r   r}   r   )r7   r   r   s   &  r   is_logged_inr   _  sd    $())#.^^6==9
 T!!  
T!!s   !A AA)N)NN)NNFF)/loggingrf   rr   r0   typingr   r   urllib.parser   rh   anaconda_authr   anaconda_auth.clientr   anaconda_auth.configr   r	   anaconda_auth.device_flowr
   anaconda_auth.exceptionsr   r   r   anaconda_auth.handlersr   anaconda_auth.tokenr   anaconda_cli_base.consoler   	getLogger__name__rj   r,   r2   rD   rN   rb   rl   rv   r   r   r   r   r   r   r   r    r   r   <module>r      s          "  % + 3 1 4 8 4 7 4 ) -			8	$6&>.bB">"!&H!"3 *.3 3( *. <" "r   