convert to gitea
This commit is contained in:
26
create_jwt.py
Normal file
26
create_jwt.py
Normal file
@ -0,0 +1,26 @@
|
||||
# create_jwt.py
|
||||
import jwt
|
||||
import time
|
||||
import base64
|
||||
# ★★★★★ 1단계에서 생성한 동일한 비밀 키를 сюда 붙여넣습니다 ★★★★★
|
||||
secret_key = "UGdiOTdLVjFBTWtndTRNRiZmVjdwMDdCRW1lSSUxTnA="
|
||||
|
||||
secret_key_64 = base64.b64decode(secret_key)
|
||||
|
||||
# 페이로드 데이터 정의 (이전과 동일)
|
||||
payload = {
|
||||
'sub': 'admin',
|
||||
'roles': ['admin'],
|
||||
'exp': int(time.time()) + 3600,
|
||||
'iat': int(time.time())
|
||||
}
|
||||
|
||||
# ★★★★★ JWT 생성 (알고리즘: HS256) ★★★★★
|
||||
token = jwt.encode(
|
||||
payload,
|
||||
secret_key_64,
|
||||
algorithm='HS256'
|
||||
)
|
||||
|
||||
# 생성된 토큰 출력
|
||||
print(token)
|
||||
Reference in New Issue
Block a user