Files
gym-manage/test-suite/tests/e2e/test_jwt_secret.py
T

31 lines
793 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
"""
测试JWT密钥
"""
import base64
# Gateway配置的secret(去掉enc:前缀)
encrypted_secret = "U2FsdGVkX1+vZ5Y9QmKxL8nN3rP7tW2jH4fG6dA8sB1cE5yN0zX3qV7wM4"
# Manage-app默认的secret
default_secret = "default-secret-key-change-in-production"
print("Gateway配置的secretBase64编码):")
print(f" {encrypted_secret}")
print(f" 长度: {len(encrypted_secret)}")
try:
decoded = base64.b64decode(encrypted_secret)
print(f"\n解码后:")
print(f" {decoded}")
print(f" 长度: {len(decoded)}")
except Exception as e:
print(f"\n解码失败: {e}")
print(f"\nManage-app默认secret:")
print(f" {default_secret}")
print(f" 长度: {len(default_secret)}")
print(f"\n两个secret是否相同: {encrypted_secret == default_secret}")