mirror of
https://github.com/ktds-dg0501/kt-event-marketing.git
synced 2025-12-06 20:46:24 +00:00
- Event Service API 엔드포인트 추가 (이벤트 생성, 조회, 수정, AI 추천, 배포) - DTO 클래스 추가 (요청/응답 모델) - Kafka Producer 구성 (AI 작업 비동기 처리) - Content Service Feign 클라이언트 구성 - Redis 설정 추가 및 테스트 컨트롤러 작성 - Docker Compose 설정 (Redis, Kafka, Zookeeper) - 백엔드 API 테스트 완료 및 결과 문서 작성 - JWT 테스트 토큰 생성 스크립트 추가 - Event Service 실행 스크립트 추가 테스트 결과: 6개 주요 API 모두 정상 작동 확인 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
66 lines
1.5 KiB
Python
66 lines
1.5 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
JWT 테스트 토큰 생성 스크립트
|
|
Event Service API 테스트용
|
|
"""
|
|
|
|
import jwt
|
|
import datetime
|
|
import uuid
|
|
|
|
# JWT Secret (run-event-service.ps1과 동일)
|
|
JWT_SECRET = "kt-event-marketing-jwt-secret-key-for-development-only-minimum-256-bits-required"
|
|
|
|
# 유효기간을 매우 길게 설정 (테스트용)
|
|
EXPIRATION_DAYS = 365
|
|
|
|
# 테스트 사용자 정보
|
|
USER_ID = str(uuid.uuid4())
|
|
STORE_ID = str(uuid.uuid4())
|
|
EMAIL = "test@example.com"
|
|
NAME = "Test User"
|
|
ROLES = ["ROLE_USER"]
|
|
|
|
def generate_access_token():
|
|
"""Access Token 생성"""
|
|
now = datetime.datetime.utcnow()
|
|
expiry = now + datetime.timedelta(days=EXPIRATION_DAYS)
|
|
|
|
payload = {
|
|
'sub': USER_ID,
|
|
'storeId': STORE_ID,
|
|
'email': EMAIL,
|
|
'name': NAME,
|
|
'roles': ROLES,
|
|
'type': 'access',
|
|
'iat': now,
|
|
'exp': expiry
|
|
}
|
|
|
|
token = jwt.encode(payload, JWT_SECRET, algorithm='HS256')
|
|
return token
|
|
|
|
if __name__ == '__main__':
|
|
print("=" * 80)
|
|
print("JWT 테스트 토큰 생성")
|
|
print("=" * 80)
|
|
print()
|
|
print(f"User ID: {USER_ID}")
|
|
print(f"Store ID: {STORE_ID}")
|
|
print(f"Email: {EMAIL}")
|
|
print(f"Name: {NAME}")
|
|
print(f"Roles: {ROLES}")
|
|
print()
|
|
print("=" * 80)
|
|
print("Access Token:")
|
|
print("=" * 80)
|
|
|
|
token = generate_access_token()
|
|
print(token)
|
|
print()
|
|
print("=" * 80)
|
|
print("사용 방법:")
|
|
print("=" * 80)
|
|
print("curl -H \"Authorization: Bearer <token>\" http://localhost:8081/api/v1/events")
|
|
print()
|