Your IP : 13.58.221.124
�
��bg~ � � � d dl Z d dlZd dlmZ d dlmZ d dlmZm Z m
Z
mZ d dlm
Z
ddlmZmZ ddlmZ dd lmZmZ dd
lmZ G d� d� � ZdS )
� N)� lru_cache)�
SSLContext)�Any�Dict�List�Optional)�URLError� )�PyJWK�PyJWKSet)�decode_complete)�PyJWKClientConnectionError�PyJWKClientError)�JWKSetCachec � � e Zd Z ddeded ed
ededeeeef d
edee fd�Z
defd�Zddedefd�Z
ddedee fd�Zdedefd�Zdedefd�Zedee dedee fd�� � ZdS )�PyJWKClientF� T�, N� �uri�
cache_keys�max_cached_keys�
cache_jwk_set�lifespan�headers�timeout�ssl_contextc � � |�i }|| _ d | _ || _ || _ || _ |r.|dk rt d|� d�� � �t
|� � | _ nd | _ |r% t |�� � | j � � | _ d S d S )Nr z/Lifespan must be greater than 0, the input is "�")�maxsize) r �
jwk_set_cacher r r r r r �get_signing_key) �selfr r r r r r r r s �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 } t j � | j | j �� � }t j � || j | j �� � 5 }t j |� � }d d d � � n# 1 swxY w Y || j
�| j
� |� � S S # t t f$ r}t d|� d�� � �d }~ww xY w# | j
�| j
� |� � w w xY w)N)�urlr )r �contextz'Fail to fetch data from the url, err: "r )�urllib�request�Requestr r �urlopenr r �json�loadr! �putr �TimeoutErrorr )r# �jwk_set�r�response�es r$ �
fetch_datazPyJWKClient.fetch_data2 sV � ��� 0���&�&�4�8�T�\�&�J�J�A���'�'��4�<��1A� (� � �
.���)�H�-�-��
.�
.�
.�
.�
.�
.�
.�
.�
.�
.�
.����
.�
.�
.�
.� ��!�-��"�&�&�w�/�/�/�/� .�� �,�'� � � �,�>�!�>�>�>�� �
����� ����� �!�-��"�&�&�w�/�/�/�/� .���sN �AB+ �A<�0B+ �<B � B+ �B �B+ �C �+C�<C�C�C �$C;�refreshc �� � d }| j �|s| j � � � }|�| � � � }t |t � � st d� � �t
j |� � S )Nz.The JWKS endpoint did not return a JSON object)r! �getr7 �
isinstance�dictr r � from_dict)r# r8 �datas r$ �get_jwk_setzPyJWKClient.get_jwk_setD sp � �����)�'�)��%�)�)�+�+�D��<��?�?�$�$�D��$��%�%� U�"�#S�T�T�T��!�$�'�'�'r&