From 2453b61d5fdc2c09c54af2f7d44c93d9e591024f Mon Sep 17 00:00:00 2001 From: happybell80 Date: Sat, 16 Aug 2025 12:09:54 +0900 Subject: [PATCH] =?UTF-8?q?docs:=20Slack/Frontend=20=EC=B1=84=EB=84=90?= =?UTF-8?q?=EB=B3=84=20=EB=A9=94=EB=AA=A8=EB=A6=AC=20=EB=B6=84=EB=A6=AC=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 동일 사용자(happybell80)가 채널별로 다른 컬렉션 사용 문제 명시 - Slack: rb10508_test_happybell80_episodic - Frontend: rb10508_test_default_episodic - 통합 해결 방안 3가지 우선순위별 정리 - Auth 서버 JWT 활용 방안을 최우선 권장 --- ideas/auth_system_analysis.md | 40 ++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/ideas/auth_system_analysis.md b/ideas/auth_system_analysis.md index 9c97a79..6d592a4 100644 --- a/ideas/auth_system_analysis.md +++ b/ideas/auth_system_analysis.md @@ -111,10 +111,14 @@ collection_name = f"{settings.ROBING_ID}_{username if username else 'default'}_{ - Robing Gateway가 JWT 토큰을 검증하지 않음 - X-User-Id 헤더만 확인 (누구나 위조 가능) -### 3. 사용자 식별 실패 ⚠️ +### 3. 사용자 식별 실패 및 채널별 메모리 분리 ⚠️ - endpoints.py에서 username 파라미터를 storage.py로 전달하지 않음 - user_id는 받지만 username으로 변환하지 않음 -- ChromaDB 컬렉션을 모든 사용자가 공유 (rb10508_test_default_episodic) +- **채널별 다른 컬렉션 사용 문제**: + - Slack: `rb10508_test_happybell80_episodic` (Auth 서버 매핑 제공) + - Frontend: `rb10508_test_default_episodic` (모든 사용자 공유) + - **동일 사용자(happybell80)가 두 채널에서 다른 메모리 공간 사용** + - 대화 내용 분리로 연속성 상실 ### 4. 이메일-유저명 매핑 하드코딩 📝 - 새 사용자 추가 시 코드 수정 필요 @@ -266,7 +270,33 @@ X-Username: happybell80 // 명확한 이름 ## 즉시 수정 필요 (Critical) -### 1. ~~Frontend (robing-api.ts)~~ ✅ 완료 +### 통합 해결 방안 (우선순위별) + +#### 1. Auth 서버 JWT 활용 (권장) 🌟 +``` +Frontend 로그인 → JWT(username 포함) → Gateway 검증 → Robing username 추출 +→ Slack과 동일한 컬렉션 사용 (rb10508_test_happybell80_episodic) +``` + +#### 2. Frontend user_id 전달 개선 +``` +로그인 후 username을 user_id로 전송 +현재: user_id = "default_user" +개선: user_id = "happybell80" +``` + +#### 3. 통합 매핑 테이블 구축 +``` +Auth 서버에 통합 매핑: +email ↔ slack_id ↔ username +- Frontend: email → username +- Slack: slack_id → username +- 결과: 동일 username으로 통합 메모리 +``` + +### 개별 수정 사항 + +#### 1. ~~Frontend (robing-api.ts)~~ ✅ 완료 ```typescript // 수정 완료 - robing-api.ts:38-41 if (token) { @@ -274,7 +304,7 @@ if (token) { } ``` -### 2. Gateway (main.py) +#### 2. Gateway (main.py) ```python # JWT 검증 추가 from app.core.auth import decode_access_token @@ -286,7 +316,7 @@ if authorization: username = payload.get("sub") # 또는 username ``` -### 3. Robing Service (rb10508_micro) +#### 3. Robing Service (rb10508_micro) ```python # endpoints.py 수정 필요: # 1. JWT 토큰에서 username 추출