관리-도구
편집 파일: jwt_token.cpython-311.pyc
� P�Cgf � �6 � d dl mZmZ d dlmZ d� Zdd�Zd� ZdS ) � )�decode� exceptions)�DEFAULT_JWT_ES_TOKEN_PATHc � � t | d�� � 5 }|� � � � � � }d d d � � n# 1 swxY w Y |S )N�rb)�mode)�open�read�strip)�jwt_path�f�token_strings ��/builddir/build/BUILDROOT/alt-python27-cllib-3.4.17-1.el8.cloudlinux.x86_64/opt/cloudlinux/venv/lib/python3.11/site-packages/clcommon/lib/jwt_token.py�read_jwtr s� � � �h�T� "� "� "� (�a��v�v�x�x�~�~�'�'��(� (� (� (� (� (� (� (� (� (� (���� (� (� (� (��s �'A�A �A Tc �h � t | dgd|ddd�d�� � }d|vrt j d� � �|S )N�HS256TF)�require_exp� verify_exp� verify_iss�verify_signature� CloudLinux)� algorithms�options�issuer�exp)r r �MissingRequiredClaimError)r r � jwt_tokens r � decode_jwtr sX � ��|�� �/3�:�]a�49� ;� ;�*�,� ,� ,�I� �I����2�5�9�9�9��� c � � d\ } }} t t � � }n%# t t f$ r ddt � d�dfcY S w xY w t |� � }|� d� � �d\ } }}n|� d� � sd\ } }}nG# t j $ r d \ } }}Y n0t j $ r d \ } }}Y nt j $ r d\ } }}Y nw xY w| ||fS )z� JWT token check :return: Tuple: success_flag, error_message, token_string success_flag: True/False - OK, JWT is valid/Error, invalid error_message: Error message token_string: Token string )T�OKNFz JWT file z read errorN�cl_plus)FzJWT token format errorN)Fz"JWT token doesn't have CL+ serviceN)FzJWT token issuer is invalidN)FzJWT token expiredN) r r �OSError�IOErrorr �getr �InvalidIssuerError�ExpiredSignatureError� PyJWTError)�success_flag� error_messager r s r �jwt_token_checkr+ sO � � 1A�-�L�-��O�� 9�:�:�����W�� O� O� O��H�";�H�H�H�$�N�N�N�N�O����Z��|�,�,� ��=�=��#�#�+�8]�5�L�-������y�)�)� j�8i�5�L�-�����(� _� _� _�4^�1��m�\�\�\��+� U� U� U�4T�1��m�\�\�\�� � Z� Z� Z�4Y�1��m�\�\�\�Z�������4�4s+ � �?�?�AB � C�!C�7C� CN)T)�jwtr r �clcommon.lib.constsr r r r+ � r r �<module>r/ sm �� #� "� "� "� "� "� "� "� 9� 9� 9� 9� 9� 9�� � �� � � �5� 5� 5� 5� 5r