https://t.me/RX1948
Server : nginx/1.24.0
System : Linux ip-172-31-33-48 6.14.0-1011-aws #11~24.04.1-Ubuntu SMP Fri Aug 1 02:07:25 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 8.3.6
Disable Function : NONE
Directory :  /lib/python3/dist-packages/botocore/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/botocore/__pycache__/tokens.cpython-312.pyc
�

P��e�*��2�ddlZddlZddlZddlZddlmZmZddlmZmZddl	Z
ddlmZddl
mZddlmZddlmZddlmZmZmZdd	lmZmZmZej6e�Zd
�Zd�Zd�Z d
�Z!Gd�de�Z"Gd�d�Z#Gd�d�Z$Gd�d�Z%y)�N)�datetime�	timedelta)�
NamedTuple�Optional)�tzutc)�UNSIGNED)�
total_seconds)�Config)�ClientError�InvalidConfigError�TokenRetrievalError)�CachedProperty�
JSONFileCache�SSOTokenLoaderc�<�tjt��S�N)r�nowr���1/usr/lib/python3/dist-packages/botocore/tokens.py�_utc_nowr$s���<�<��� � rc�2�t|�g}t|��S)N)�	providers)�SSOTokenProvider�TokenProviderChain)�sessionrs  r�create_token_resolverr(s����!��I��	�2�2rc�H�t|t�r|jd�S|S)Nz%Y-%m-%dT%H:%M:%SZ)�
isinstancer�strftime��objs r�_serialize_utc_timestampr#/s!���#�x� ��|�|�0�1�1��Jrc�8�tj|t��S)N)�default)�json�dumpsr#r!s r�_sso_json_dumpsr(5s���:�:�c�#;�<�<rc�,�eZdZUeed<dZeeed<y)�FrozenAuthToken�tokenN�
expiration)�__name__�
__module__�__qualname__�str�__annotations__r,rrrrrr*r*9s���J�%)�J���"�)rr*c�@�eZdZdZdZdZefd�Zd�Zd�Z	d�Z
d�Zd	�Zy
)�DeferredRefreshableToken�iX�<c�|�||_||_||_tj�|_d|_d|_yr)�
_time_fetcher�_refresh_using�method�	threading�Lock�
_refresh_lock�
_frozen_token�
_next_refresh)�selfr9�
refresh_using�time_fetchers    r�__init__z!DeferredRefreshableToken.__init__Gs:��)���+������'�^�^�-���!���!��rc�:�|j�|jSr)�_refreshr=�r?s r�get_frozen_tokenz)DeferredRefreshableToken.get_frozen_tokenQs���
�
���!�!�!rc��|j�}|sy|dk(}|jj|�r,	|j�|jj	�yy#|jj	�wxYw)N�	mandatory)�_should_refreshr<�acquire�_protected_refresh�release)r?�refresh_type�block_for_refreshs   rrDz!DeferredRefreshableToken._refreshUsv���+�+�-����)�K�7�����%�%�&7�8�
-��'�'�)��"�"�*�*�,�	9���"�"�*�*�,�s�A!�!A=c�Z�|j�}|sy	|j�}|t|j��z|_|j�|_|j�rt|jd���y#t$r!tjd|d��|dk(r�Y�QwxYw)N��secondsz5Refreshing token failed during the %s refresh period.T��exc_inforHz$Token has expired and refresh failed)�provider�	error_msg)
rIr7r�_attempt_timeoutr>r8r=�	Exception�logger�warning�_is_expiredr
r9)r?rMrs   rrKz+DeferredRefreshableToken._protected_refreshcs����+�+�-����	��$�$�&�C�!$�y��9N�9N�'O�!O�D��!%�!4�!4�!6�D������%����@��
����	��N�N�G���
�
�
�{�*��+�
	�s�AB�'B*�)B*c��|j�y|jj}t||j�z
�}|dkS)NFr)r=r,r	r7)r?r,�	remainings   rrZz$DeferredRefreshableToken._is_expiredsD�����%���'�'�2�2�
�!�*�t�/A�/A�/C�"C�D�	��A�~�rc���|j�y|jj}|�y|j�}||jkryt	||z
�}||j
kry||jkryy)NrH�advisory)r=r,r7r>r	�_mandatory_refresh_timeout�_advisory_refresh_timeout)r?r,rr\s    rrIz(DeferredRefreshableToken._should_refresh�s~�����%���'�'�2�2�
����� � �"����#�#�#��!�*�s�"2�3�	��t�6�6�6��
��7�7�
7��rN)
r-r.r/r`r_rVrrBrFrDrKrZrIrrrr3r3>s7��!(��!(����;C�"�"�-��8�rr3c��eZdZdd�Zd�Zy)rNc��|�g}||_yr)�
_providers)r?rs  rrBzTokenProviderChain.__init__�s�����I�#��rc�R�|jD]}|j�}|��|cSyr)rc�
load_token)r?rTr+s   rrezTokenProviderChain.load_token�s3�����	�H��'�'�)�E�� ���	�rr)r-r.r/rBrerrrrr�s��$�
rrc���eZdZdZdZejjejjdddd��Z	ddgZ
dZeZ
d	ed	fd
�Zd�Zed��Zed
��Zd�Zd�Zd�Zd�Zy	)r�ssor4�~z.aws�cache�
sso_start_url�
sso_region�
refresh_tokenNc��||_|�!|j|jt��}||_||_t
|j
��|_|xs|jjd�xsd|_	y)N)�
dumps_func)ri�profiler%)
�_session�DEFAULT_CACHE_CLS�_SSO_TOKEN_CACHE_DIRr(�_now�_cacher�
_token_loader�get_config_variable�
_profile_name)r?rrirA�profile_names     rrBzSSOTokenProvider.__init__�s|�� ��
��=��*�*��)�)�*�+��E�!��	����+�$�+�+�>����
��}�}�0�0��;�
��	
�rc���|jj}|jdi�}|jdi�}|j|ji�}d|vry|d}|j|d�}|sd|j�d|�d�}t	|���g}|j
D]}	|	|vs�|j
|	��|rd|j�d|�d	�}t	|���||d
|dd�S)
N�profiles�sso_sessions�sso_sessionz
The profile "z7" is configured to use the SSO token provider but the "z+" sso_session configuration does not exist.)rUzZ" is configured to use the SSO token provider but is missing the following configuration: �.rkrj)�session_namerkrj)rp�full_config�getrwr�_SSO_CONFIG_VARS�append)
r?�
loaded_configrzr{�profile_config�sso_session_name�
sso_configrU�missing_configs�vars
          r�_load_sso_configz!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�'��8�
�	
rc�"�|j�Sr)r�rEs r�_sso_configzSSOTokenProvider._sso_config�s���$�$�&�&rc�x�t|jdt��}|jj	d|��S)Nrk)�region_name�signature_versionzsso-oidc)�config)r
r�rrp�
create_client)r?r�s  r�_clientzSSOTokenProvider._client�s9����(�(��6�&�
���}�}�*�*�:�f�*�E�Erc�L�|jj|j|d|d|d��}t|d��}|jd|jd|d	|j�|z|d|d|d
d�}d|vr|d|d<tjd�|S)
N�clientId�clientSecret�refreshToken)�	grantTyper�r�r��	expiresInrPrjrk�accessToken�registrationExpiresAt)�startUrl�regionr��	expiresAtr�r�r�zSSO Token refresh succeeded)r��create_token�_GRANT_TYPErr�rsrX�info)r?r+�response�
expires_in�	new_tokens     r�_attempt_create_tokenz&SSOTokenProvider._attempt_create_token�s����<�<�,�,��&�&��:�&��~�.��~�.�	-�
���x��'<�=�
��(�(��9��&�&�|�4�#�M�2�����z�1��j�)�!�.�1�%*�+B�%C�	
�	��X�%�(0��(@�I�n�%����1�2��rc��d}|D�cgc]	}||vs�|��}}|rd|��}tj|�ytjj	|d�}t||j
�z
�dkrtjd|���y	|j|�Scc}w#t$rtjdd��YywxYw)	N)r�r�r�r�z+Unable to refresh SSO token: missing keys: r�rz"SSO token registration expired at z SSO token refresh attempt failedTrR)
rXr��dateutil�parser�parser	rsr�rrY)r?r+�keys�k�missing_keys�msg�expirys       r�_refresh_access_tokenz&SSOTokenProvider._refresh_access_tokens���
��$(�:�a�1�E�>��:��:��?��~�N�C��K�K�������&�&�u�-D�'E�F����$�)�)�+�-�.�!�3��K�K�<�V�H�E�F��	��-�-�e�4�4��;���	��N�N�=��N�M��	�s�	B �B �B%�% C�Cc���|jd}|jd}tjd|���|j||��}tj
j
|d�}tjd|���t||j�z
�}||jkr8|j|�}|�%|}|d}|jj|||��t|d|��S)	Nrjr~zLoading cached SSO token for )r~r�zCached SSO token expires at r�)r,)r�rXr�rur�r�r��debugr	rs�_REFRESH_WINDOWr��
save_tokenr*)r?�	start_urlr~�
token_dictr,r\�new_token_dicts       r�
_refresherzSSOTokenProvider._refresher.s����$�$�_�5�	��'�'��7�����3�L�>�B�C��'�'�	��'�M�
��_�_�*�*�:�k�+B�C�
����3�J�<�@�A�!�*�t�y�y�{�":�;�	��t�+�+�+�!�7�7�
�C�N��)�+�
�'��4�
��"�"�-�-��z��.����}�%�*�
�	
rc�t�|j�yt|j|j|j��S)N)rA)r�r3�METHODr�rsrEs rrezSSOTokenProvider.load_tokenDs1�����#��'��K�K����t�y�y�
�	
r)r-r.r/r�r��os�path�
expanduser�joinrrr�r�rrqrrBr�rr�r�r�r�r�rerrrrr�s���
�F��O��7�7�-�-�
�����S�&�%��1���	����"�K�%��"��t�
�$%
�N�'��'��F��F��.�0
�,
rr)&r&�loggingr�r:rr�typingrr�dateutil.parserr��dateutil.tzr�botocorer�botocore.compatr	�botocore.configr
�botocore.exceptionsrrr
�botocore.utilsrrr�	getLoggerr-rXrrr#r(r*r3rrrrr�<module>r�s�����	��(�'����)�"���
I�H�	��	�	�8�	$��!�3��=�*�j�*�
^�^�B��]
�]
r

https://t.me/RX1948 - 2025