관리-도구
편집 파일: jwt_issuer.cpython-311.opt-1.pyc
� IMg� � � � d dl Z d dlZd dlZd dlmZmZ d dlmZ d dlmZ d dl m Z mZ d dlm Z e j ej e j ej iZ G d� d� � ZdS ) � N)�datetime� timedelta)�Path)�InvalidTokenException)�UIRole�UserType)�atomic_rewritec � � e Zd Z ed� � Z ed� � Z ed�� � Z ed�� � Ze d� � � Z e defd �� � Ze d ede defd�� � Ze d edededz fd�� � Ze d efd�� � ZdS )� JWTIssuerz/var/imunify360/.api-secret.keyz$/var/imunify360/.api-secret-prev.key� )�hours� )�daysc �� � t j | j � � }|j }n# t $ r d}Y nw xY wt j � � � � � |z | j j k S )Ng ) �os�stat�JWT_SECRET_FILE�st_mtime�FileNotFoundErrorr �now� timestamp�SECRET_EXPIRATION_TTL�seconds)�clsr r s �S/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/api/jwt_issuer.py�is_secret_expiredzJWTIssuer.is_secret_expired sy � � %��7�3�.�/�/�D� �}�H�H�� !� � � ��H�H�H� ���� �L�N�N�$�$�&�&��1��'�/� 0� s �# �2�2�returnc � � | � � � r�d� d� t d� � D � � � � }| j � � � s| j � � � t t | j � � |t | j � � dd�� � |S | j � � � S )N� c 3 �l K � | ]/}t j t j t j z � � V � �0d S )N)�random�choice�string�ascii_uppercase�digits)�.0�_s r � <genexpr>z(JWTIssuer._get_secret.<locals>.<genexpr>'