관리-도구
편집 파일: jwks_client.cpython-37.opt-1.pyc
B �E�`� � @ sf d dl Z d dlZd dlmZ d dlmZmZ ddlm Z m Z ddlmZ ddlmZ G dd � d �ZdS ) � N)� lru_cache)�Any�List� )�PyJWK�PyJWKSet)�decode_complete)�PyJWKClientErrorc @ sn e Zd Zdeeed�dd�Zed�dd�Ze d�d d �Z ee d�dd�Z eed �dd�Zeed�dd�ZdS )�PyJWKClientT� )�uri� cache_keys�max_cached_keysc C s || _ |rt|d�| j�| _d S )N)�maxsize)r r �get_signing_key)�selfr r r � r �@/opt/alt/python37/lib/python3.7/site-packages/jwt/jwks_client.py�__init__ s zPyJWKClient.__init__)�returnc C s$ t j�| j��}t�|�S Q R X d S )N)�urllibZrequestZurlopenr �json�load)r Zresponser r r � fetch_data s zPyJWKClient.fetch_datac C s | � � }t�|�S )N)r r Z from_dict)r �datar r r �get_jwk_set s zPyJWKClient.get_jwk_setc C sN | � � }g }x(|jD ]}|jdkr|jr|�|� qW t|�dkrJtd��|S )N�sigr z2The JWKS endpoint did not contain any signing keys)r �keysZpublic_key_use�key_id�append�lenr )r Zjwk_set�signing_keysZjwk_set_keyr r r �get_signing_keys s zPyJWKClient.get_signing_keys)�kidr c C sB | � � }d }x|D ]}|j|kr|}P qW |s>td|� d���|S )Nz,Unable to find a signing key that matches: "�")r"