Your IP : 13.58.221.124


Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/jwt/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/jwt/__pycache__/jwks_client.cpython-311.pyc

�

��bg~���ddlZddlZddlmZddlmZddlmZm	Z	m
Z
mZddlm
Z
ddlmZmZddlmZdd	lmZmZdd
lmZGd�d��ZdS)
�N)�	lru_cache)�
SSLContext)�Any�Dict�List�Optional)�URLError�)�PyJWK�PyJWKSet)�decode_complete)�PyJWKClientConnectionError�PyJWKClientError)�JWKSetCachec��eZdZ							ddeded	ed
ededeeeefd
edee	fd�Z
defd�Zddedefd�Z
ddedeefd�Zdedefd�Zdedefd�Zedeededeefd���ZdS)�PyJWKClientF�T�,N��uri�
cache_keys�max_cached_keys�
cache_jwk_set�lifespan�headers�timeout�ssl_contextc	��|�i}||_d|_||_||_||_|r.|dkrtd|�d����t
|��|_nd|_|r%t|���|j��|_dSdS)Nrz/Lifespan must be greater than 0, the input is "�")�maxsize)	r�
jwk_set_cacherrrrrr�get_signing_key)	�selfrrrrrrrrs	         �F/opt/cloudlinux/venv/lib64/python3.11/site-packages/jwt/jwks_client.py�__init__zPyJWKClient.__init__s����?��G����48���������&����		&��1�}�}�&�Q�h�Q�Q�Q����"-�X�!6�!6�D���!%�D���	\�$F�9�_�#E�#E�#E�d�FZ�#[�#[�D� � � �	\�	\��returnc��d}	tj�|j|j���}tj�||j|j���5}tj	|��}ddd��n#1swxYwY||j
�|j
�|��SS#ttf$r}td|�d����d}~wwxYw#|j
�|j
�|��wwxYw)N)�urlr)r�contextz'Fail to fetch data from the url, err: "r)�urllib�request�Requestrr�urlopenrr�json�loadr!�putr	�TimeoutErrorr)r#�jwk_set�r�response�es     r$�
fetch_datazPyJWKClient.fetch_data2sV����	0���&�&�4�8�T�\�&�J�J�A���'�'��4�<��1A�(���
.���)�H�-�-��
.�
.�
.�
.�
.�
.�
.�
.�
.�
.�
.����
.�
.�
.�
.���!�-��"�&�&�w�/�/�/�/�.���,�'�	�	�	�,�>�!�>�>�>���
�����	������!�-��"�&�&�w�/�/�/�/�.���sN�AB+�A<�0B+�<B�B+�B�B+�C�+C�<C�C�C�$C;�refreshc���d}|j�|s|j���}|�|���}t|t��std���t
j|��S)Nz.The JWKS endpoint did not return a JSON object)r!�getr7�
isinstance�dictrr�	from_dict)r#r8�datas   r$�get_jwk_setzPyJWKClient.get_jwk_setDsp������)�'�)��%�)�)�+�+�D��<��?�?�$�$�D��$��%�%�	U�"�#S�T�T�T��!�$�'�'�'r&c�t�|�|��}d�|jD��}|std���|S)Nc�2�g|]}|jdv�|j�|��S))�sigN)�public_key_use�key_id)�.0�jwk_set_keys  r$�
<listcomp>z0PyJWKClient.get_signing_keys.<locals>.<listcomp>Ss8��
�
�
���)�]�:�:�{�?Q�:�
�:�:�:r&z2The JWKS endpoint did not contain any signing keys)r?�keysr)r#r8r3�signing_keyss    r$�get_signing_keyszPyJWKClient.get_signing_keysQsU���"�"�7�+�+��
�
�&�|�
�
�
���	Y�"�#W�X�X�X��r&�kidc���|���}|�||��}|sA|�d���}|�||��}|std|�d����|S)NT)r8z,Unable to find a signing key that matches: "r)rJ�	match_kidr)r#rKrI�signing_keys    r$r"zPyJWKClient.get_signing_key^s����,�,�.�.���n�n�\�3�7�7���	��0�0��0�>�>�L��.�.��s�;�;�K��
�&�I�3�I�I�I�����r&�tokenc��t|ddi���}|d}|�|�d����S)N�verify_signatureF)�options�headerrK)�decode_tokenr"r:)r#rO�
unverifiedrSs    r$�get_signing_key_from_jwtz$PyJWKClient.get_signing_key_from_jwtnsD��!�%�2D�e�1L�M�M�M�
��H�%���#�#�F�J�J�u�$5�$5�6�6�6r&rIc�2�d}|D]}|j|kr|}n�|S)N)rD)rIrKrN�keys    r$rMzPyJWKClient.match_kidss:�����	�	�C��z�S� � �!����!��r&)FrTrNrN)F)�__name__�
__module__�__qualname__�str�bool�intrrrrr%r7rr?rrrJr"rV�staticmethodrM�r&r$rrs�������!�!�"��,0��,0�!\�!\�
�!\��!\��	!\�
�!\��
!\��$�s�C�x�.�)�!\��!\��j�)�!\�!\�!\�!\�F0�C�0�0�0�0�$(�(�4�(�H�(�(�(�(������e�������3��5����� 7�c�7�e�7�7�7�7�
���U���#��(�5�/�����\���r&r)r/�urllib.requestr+�	functoolsr�sslr�typingrrrr�urllib.errorr	�api_jwkrr�api_jwtr
rT�
exceptionsrrr!rrr`r&r$�<module>ris����������������������,�,�,�,�,�,�,�,�,�,�,�,�!�!�!�!�!�!�$�$�$�$�$�$�$�$�4�4�4�4�4�4�D�D�D�D�D�D�D�D�&�&�&�&�&�&�n�n�n�n�n�n�n�n�n�nr&

?>