+
    i-                     P   ^ RI t ^ RIt^ RIt^ RIt^ RIHtHt ^ RIHt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HtHt ^ R	IHtHtHtHtHt ]P:                  ! ]4      tR
 t R t!R t"R t# ! R R]4      t$ ! R R4      t% ! R R4      t& ! R R4      t' ! R R4      t(R# )    N)datetime	timedelta)
NamedTupleOptional)tzutc)UNSIGNED)total_seconds)Config)ClientErrorInvalidConfigErrorTokenRetrievalError)CachedPropertyJSONFileCacheSSOTokenLoadercreate_nested_clientget_token_from_environmentc                  >    \         P                  ! \        4       4      # N)r   nowr        1/usr/lib/python3/dist-packages/botocore/tokens.py_utc_nowr   *   s    <<  r   c                 F    \        V 4      \        V 4      .p\        VR 7      # ))	providers)ScopedEnvTokenProviderSSOTokenProviderTokenProviderChain)sessionr   s   & r   create_token_resolverr    .   s&    w'!I 	22r   c                 T    \        V \        4      '       d   V P                  R 4      # V # )z%Y-%m-%dT%H:%M:%SZ)
isinstancer   strftimeobjs   &r   _serialize_utc_timestampr&   6   s$    #x  ||011Jr   c                 :    \         P                  ! V \        R 7      # ))default)jsondumpsr&   r$   s   &r   _sso_json_dumpsr+   <   s    ::c#;<<r   c                   0   a  ] tR t^@t o RtV 3R ltRtV tR# )FrozenAuthTokenNc                B   < V ^8  d   Qh/ S[ ;R&   S[S[,          ;R&   # )   token
expiration)strr   r   )format__classdict__s   "r   __annotate__FrozenAuthToken.__annotate__@   s     J ") r   r   )__name__
__module____qualname____firstlineno__r1   __annotate_func____static_attributes____classdictcell__r4   s   @r   r-   r-   @   s     %)J  r   r-   c                   V   a  ] tR t^Et o R	tR
t^<t]3R ltR t	R t
R tR tR tRtV tR# )DeferredRefreshableTokenc                z    W0n         W n        Wn        \        P                  ! 4       V n        R V n        R V n        R # r   )_time_fetcher_refresh_usingmethod	threadingLock_refresh_lock_frozen_token_next_refresh)selfrD   refresh_usingtime_fetchers   &&&&r   __init__!DeferredRefreshableToken.__init__N   s4    )+ '^^-!!r   c                :    V P                  4        V P                  # r   )_refreshrH   rJ   s   &r   get_frozen_token)DeferredRefreshableToken.get_frozen_tokenX   s    !!!r   c                   V P                  4       pV'       g   R # VR8H  pV P                  P                  V4      '       d.    V P                  4        V P                  P	                  4        R # R #   T P                  P	                  4        i ; i)N	mandatory)_should_refreshrG   acquire_protected_refreshrelease)rJ   refresh_typeblock_for_refreshs   &  r   rP   !DeferredRefreshableToken._refresh\   sy    ++- )K7%%&788-'')""**,	 9 ""**,s   A0 0Bc                   V P                  4       pV'       g   R #  V P                  4       pV\        V P                  R7      ,           V n        V P                  4       V n        V P                  4       '       d   \        V P                  RR7      hR #   \         d$    \        P                  RTRR7       TR8X  d   h  L\i ; i)Nsecondsz5Refreshing token failed during the %s refresh period.Texc_inforU   z$Token has expired and refresh failed)provider	error_msg)rV   rB   r   _attempt_timeoutrI   rC   rH   	Exceptionloggerwarning_is_expiredr   rD   )rJ   rZ   r   s   &  r   rX   +DeferredRefreshableToken._protected_refreshj   s     ++-	$$&C!$y9N9N'O!OD!%!4!4!6D %@    	NNG  
 {* +	s   AB +C ?C c                    V P                   f   R# V P                   P                  p\        WP                  4       ,
          4      pV^ 8*  # )NF)rH   r1   r	   rB   )rJ   r1   	remainings   &  r   rh   $DeferredRefreshableToken._is_expired   sB    %''22
!*/A/A/C"CD	A~r   c                   V P                   f   R# V P                   P                  pVf   R # V P                  4       pW P                  8  d   R # \	        W,
          4      pW0P
                  8  d   R# W0P                  8  d   R# R # )NrU   advisory)rH   r1   rB   rI   r	   _mandatory_refresh_timeout_advisory_refresh_timeout)rJ   r1   r   rk   s   &   r   rV   (DeferredRefreshableToken._should_refresh   sv    %''22
  "###!*"23	666777r   )rH   rI   rG   rC   rB   rD   N  iX  )r7   r8   r9   r:   rp   ro   rd   r   rM   rR   rP   rX   rh   rV   r<   r=   r>   s   @r   r@   r@   E   s?      !(!(;C ""-8 r   r@   c                   0   a  ] tR t^t o RR ltR tRtV tR# )r   Nc                    Vf   . pWn         R # r   
_providers)rJ   r   s   &&r   rM   TokenProviderChain.__init__   s    I#r   c                `    V P                    F  pVP                  ! R/ VB pVf   K  Vu # 	  R # )Nr   )rv   
load_token)rJ   kwargsrb   r0   s   &,  r   ry   TokenProviderChain.load_token   s3    H''1&1E  ( r   ru   r   )r7   r8   r9   r:   rM   ry   r<   r=   r>   s   @r   r   r      s     $
 r   r   c                      a  ] tR t^t o RtRt]P                  P                  ]P                  P                  RRRR4      4      t
RR.tRt]tR]R3R	 ltR
 t]R 4       t]R 4       tR tR tR tR tRtV tR# )r   sso~z.awscachesso_start_url
sso_regionrefresh_tokenNc                   Wn         Vf"   V P                  V P                  \        R7      pW0n        W n        \        V P
                  R7      V n        T;'       g&    V P                   P                  R4      ;'       g    RV n	        R # )N)
dumps_func)r   profiler(   )
_sessionDEFAULT_CACHE_CLS_SSO_TOKEN_CACHE_DIRr+   _now_cacher   _token_loaderget_config_variable_profile_name)rJ   r   r   rL   profile_names   &&&&&r   rM   SSOTokenProvider.__init__   s      =**))* + E !	+$++>  }}00;  	r   c                   V P                   P                  pVP                  R / 4      pVP                  R/ 4      pVP                  V P                  / 4      pRV9  d   R# VR,          pVP                  VR4      pV'       g    RV P                   RV R2p\	        VR7      h. pV P
                   F  p	W9  g   K  VP                  V	4       K  	  V'       d    RV P                   RV R	2p\	        VR7      hR
VRVR,          RVR,          /# )profilessso_sessionssso_sessionNzThe profile "z7" is configured to use the SSO token provider but the "z+" sso_session configuration does not exist.)rc   zZ" is configured to use the SSO token provider but is missing the following configuration: .session_namer   r   )r   full_configgetr   r   _SSO_CONFIG_VARSappend)
rJ   loaded_configr   r   profile_configsso_session_name
sso_configrc   missing_configsvars
   &         r   _load_sso_config!SSOTokenProvider._load_sso_config   s3   11 $$Z4$((<!d&8&8"=.)-8!%%&6=
 2 23 4++;*< =01 
 %y99((C$&&s+ )  2 23 4N"#1& 
 %y99 ,*\2Z8
 	
r   c                "    V P                  4       # r   )r   rQ   s   &r   _sso_configSSOTokenProvider._sso_config   s    $$&&r   c                v    \        V P                  R ,          \        R7      p\        V P                  RVR7      # )r   )region_namesignature_versionzsso-oidc)config)r
   r   r   r   r   )rJ   r   s   & r   _clientSSOTokenProvider._client   s2    ((6&
 $DMM:fMMr   c                   V P                   P                  V P                  VR ,          VR,          VR,          R7      p\        VR,          R7      pRV P                  R,          RV P                  R	,          R
VR
,          RV P                  4       V,           R VR ,          RVR,          RVR,          /pRV9   d   VR,          VR&   \        P                  R4       V# )clientIdclientSecretrefreshToken)	grantTyper   r   r   	expiresInr^   startUrlr   regionr   accessToken	expiresAtregistrationExpiresAtzSSO Token refresh succeeded)r   create_token_GRANT_TYPEr   r   r   rf   info)rJ   r0   response
expires_in	new_tokens   &&   r   _attempt_create_token&SSOTokenProvider._attempt_create_token  s    <<,,&&:&~.~.	 - 
 x'<=
((9d&&|48M2z1j)E.1#U+B%C	
	 X%(0(@In%12r   c                   RpV Uu. uF  q3V9  g   K  VNK  	  ppV'       d   RV 2p\         P                  V4       R# \        P                  P	                  VR,          4      p\        W`P                  4       ,
          4      ^ 8:  d   \         P                  RV4       R#  V P                  V4      # u upi   \         d    \         P                  RRR7        R# i ; i)	r   r   z+Unable to refresh SSO token: missing keys: Nz$SSO token registration expired at %sz SSO token refresh attempt failedTr`   )r   r   r   r   )
rf   r   dateutilparserparser	   r   r   r   rg   )rJ   r0   keyskmissing_keysmsgexpirys   &&     r   _refresh_access_token&SSOTokenProvider._refresh_access_token  s    
 $(:4aE>4:?~NCKK&&u-D'EF))+-.!3KK>G	--e44 ;  	NN=NM	s   B4B4#B9 9"CCc                   V P                   R ,          pV P                   R,          p\        P                  RV4       V P                  WR7      p\        P
                  P                  VR,          4      p\        P                  RV4       \        W@P                  4       ,
          4      pWPP                  8  d>   V P                  V4      pVe)   TpVR,          pV P                  P                  WVR7       \        VR,          VR7      # )r   r   zLoading cached SSO token for %s)r   r   zCached SSO token expires at %sr   )r1   )r   rf   r   r   r   r   r   debugr	   r   _REFRESH_WINDOWr   
save_tokenr-   )rJ   	start_urlr   
token_dictr1   rk   new_token_dicts   &      r   
_refresherSSOTokenProvider._refresher5  s    $$_5	''75|D''	'M
__**:k+BC
5zB!*yy{":;	+++!77
CN)+
'4
""-- .  }%*
 	
r   c                z    V P                   f   R # \        V P                  V P                  V P                  R7      # )N)rL   )r   r@   METHODr   r   )rJ   rz   s   &,r   ry   SSOTokenProvider.load_tokenK  s1    #'KKtyy
 	
r   )r   r   r   r   r   rr   )r7   r8   r9   r:   r   r   ospath
expanduserjoinr   r   r   r   r   r   rM   r   r   r   r   r   r   r   ry   r<   r=   r>   s   @r   r   r      s     FO77--
S&%1 	 "K% "t
$%
N ' ' N N.0
,
 
r   r   c                   8   a  ] tR tRt o RtRtRR ltR tRtV t	R# )	r   iT  zb
Token provider that loads tokens from environment variables scoped to
a specific `signing_name`.
envNc                F    Wn         Vf   \        P                  pW n        R # r   )r   r   environ)rJ   r   r   s   &&&r   rM   ScopedEnvTokenProvider.__init__\  s    ?jjGr   c                    VP                  R 4      pVf   R# \        W P                  4      pVe!   \        P	                  R4       \        V4      # R# )signing_nameNz%Found token in environment variables.)r   r   r   rf   r   r-   )rJ   rz   r   r0   s   &,  r   ry   !ScopedEnvTokenProvider.load_tokenb  sJ    zz.1*<FKK?@"5)) r   )r   r   r   )
r7   r8   r9   r:   __doc__r   rM   ry   r<   r=   r>   s   @r   r   r   T  s      
 F	* 	*r   r   ))r)   loggingr   rE   r   r   typingr   r   dateutil.parserr   dateutil.tzr   botocorer   botocore.compatr	   botocore.configr
   botocore.exceptionsr   r   r   botocore.utilsr   r   r   r   r   	getLoggerr7   rf   r   r    r&   r+   r-   r@   r   r   r   r   r   r   <module>r      s      	  ( '    ) " 
  
		8	$!3=*j *
^ ^B ]
 ]
@* *r   