diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index def9b1c..c66d815 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -6,7 +6,7 @@ ``` [Cloudflare Tunnel] → tk-cloudflared - ├── tkds.technicalkorea.net → tk-gateway:80 (로그인 + 대시보드 + 공유JS) + ├── tkfb.technicalkorea.net → tk-gateway:80 (로그인 + 대시보드 + 공유JS) ├── tkfb.technicalkorea.net → tk-system1-web:80 (공장관리) ├── tkreport.technicalkorea.net → tk-system2-web:80 (신고) ├── tkqc.technicalkorea.net → tk-system3-web:80 (부적합관리) @@ -56,7 +56,7 @@ ## SSO 인증 흐름 1. 사용자가 아무 서비스 접근 → 프론트엔드 JS가 `sso_token` 쿠키 확인 -2. 토큰 없음/만료 → `tkds.technicalkorea.net/dashboard`로 리다이렉트 (redirect 파라미터 포함) +2. 토큰 없음/만료 → `tkfb.technicalkorea.net/dashboard`로 리다이렉트 (redirect 파라미터 포함) 3. 로그인 폼 제출 → `POST /auth/login` → sso-auth가 JWT 발급 4. 쿠키 설정: `sso_token`, `sso_user`, `sso_refresh_token` (domain=`.technicalkorea.net`) 5. redirect 파라미터가 있으면 원래 페이지로, 없으면 대시보드 표시 @@ -76,7 +76,7 @@ Gateway(`/shared/`)에서 서빙: 각 서비스의 core.js에서 동적 로딩: ``` -프로덕션: https://tkds.technicalkorea.net/shared/notification-bell.js +프로덕션: https://tkfb.technicalkorea.net/shared/notification-bell.js 로컬: http://localhost:30000/shared/notification-bell.js ``` @@ -89,7 +89,7 @@ Gateway(`/shared/`)에서 서빙: 5. `sso-auth-service/config/`에 새 origin 추가 6. `system1-factory/api/config/cors.js`에 새 origin 추가 (API 호출 시) 7. 알림 벨 사용 시: core.js에 `_loadNotificationBell()` 함수 추가 -8. 로그인 리다이렉트: `tkds.technicalkorea.net/dashboard?redirect=` 패턴 사용 +8. 로그인 리다이렉트: `tkfb.technicalkorea.net/dashboard?redirect=` 패턴 사용 ## 배포 절차 diff --git a/gateway/html/shared/nav-header.js b/gateway/html/shared/nav-header.js index 6e9a4fb..6918ddf 100644 --- a/gateway/html/shared/nav-header.js +++ b/gateway/html/shared/nav-header.js @@ -62,7 +62,7 @@ var loginUrl; if (hostname.includes('technicalkorea.net')) { - loginUrl = window.location.protocol + '//tkds.technicalkorea.net/dashboard'; + loginUrl = window.location.protocol + '//tkfb.technicalkorea.net/dashboard'; } else { // 개발 환경: tkds 포트 (30780) loginUrl = window.location.protocol + '//' + hostname + ':30780/dashboard'; diff --git a/sso-auth-service/index.js b/sso-auth-service/index.js index d63c177..fdd99b8 100644 --- a/sso-auth-service/index.js +++ b/sso-auth-service/index.js @@ -23,7 +23,7 @@ const allowedOrigins = [ 'https://tkpurchase.technicalkorea.net', 'https://tksafety.technicalkorea.net', 'https://tksupport.technicalkorea.net', - 'https://tkds.technicalkorea.net', + 'https://tkfb.technicalkorea.net', ]; if (process.env.NODE_ENV === 'development') { allowedOrigins.push('http://localhost:30000', 'http://localhost:30080', 'http://localhost:30180', 'http://localhost:30280', 'http://localhost:30380'); diff --git a/system1-factory/api/config/cors.js b/system1-factory/api/config/cors.js index 93042fe..a0fe5d5 100644 --- a/system1-factory/api/config/cors.js +++ b/system1-factory/api/config/cors.js @@ -14,7 +14,7 @@ const logger = require('../utils/logger'); */ const allowedOrigins = [ 'https://tkfb.technicalkorea.net', // System 1 (공장관리) - 'https://tkds.technicalkorea.net', // Gateway/Dashboard + 'https://tkfb.technicalkorea.net', // Gateway/Dashboard 'https://tkreport.technicalkorea.net', // System 2 'https://tkqc.technicalkorea.net', // System 3 'https://tkuser.technicalkorea.net', // User Management diff --git a/system1-factory/web/js/api-base.js b/system1-factory/web/js/api-base.js index 57f531c..e576a6d 100644 --- a/system1-factory/web/js/api-base.js +++ b/system1-factory/web/js/api-base.js @@ -52,7 +52,7 @@ if ('caches' in window) { window.getLoginUrl = function() { var hostname = window.location.hostname; if (hostname.includes('technicalkorea.net')) { - return window.location.protocol + '//tkds.technicalkorea.net/dashboard?redirect=' + encodeURIComponent(window.location.href); + return window.location.protocol + '//tkfb.technicalkorea.net/dashboard?redirect=' + encodeURIComponent(window.location.href); } // 개발 환경: tkds 포트 (30780) return window.location.protocol + '//' + hostname + ':30780/dashboard?redirect=' + encodeURIComponent(window.location.href); diff --git a/system1-factory/web/static/js/tkfb-core.js b/system1-factory/web/static/js/tkfb-core.js index c41b82e..09c4de3 100644 --- a/system1-factory/web/static/js/tkfb-core.js +++ b/system1-factory/web/static/js/tkfb-core.js @@ -25,7 +25,7 @@ function getToken() { return _cookieGet('sso_token') || localStorage.getItem('ss function getLoginUrl() { const h = location.hostname; const t = Date.now(); - if (h.includes('technicalkorea.net')) return location.protocol + '//tkds.technicalkorea.net/dashboard?redirect=' + encodeURIComponent(location.href) + '&_t=' + t; + if (h.includes('technicalkorea.net')) return location.protocol + '//tkfb.technicalkorea.net/dashboard?redirect=' + encodeURIComponent(location.href) + '&_t=' + t; return location.protocol + '//' + h + ':30780/dashboard?redirect=' + encodeURIComponent(location.href) + '&_t=' + t; } function decodeToken(t) { try { const b = atob(t.split('.')[1].replace(/-/g,'+').replace(/_/g,'/')); return JSON.parse(new TextDecoder().decode(Uint8Array.from(b, c => c.charCodeAt(0)))); } catch { return null; } } @@ -314,7 +314,7 @@ async function initAuth() { /* ===== 알림 벨 ===== */ function _loadNotificationBell() { const s = document.createElement('script'); - s.src = (location.hostname.includes('technicalkorea.net') ? 'https://tkds.technicalkorea.net' : location.protocol + '//' + location.hostname + ':30000') + '/shared/notification-bell.js?v=4'; + s.src = (location.hostname.includes('technicalkorea.net') ? 'https://tkfb.technicalkorea.net' : location.protocol + '//' + location.hostname + ':30000') + '/shared/notification-bell.js?v=4'; document.head.appendChild(s); } diff --git a/system2-report/web/js/api-base.js b/system2-report/web/js/api-base.js index 67e3698..31c1804 100644 --- a/system2-report/web/js/api-base.js +++ b/system2-report/web/js/api-base.js @@ -53,7 +53,7 @@ if ('serviceWorker' in navigator) { var hostname = window.location.hostname; var t = Date.now(); if (hostname.includes('technicalkorea.net')) { - return window.location.protocol + '//tkds.technicalkorea.net/dashboard?redirect=' + encodeURIComponent(window.location.href) + '&_t=' + t; + return window.location.protocol + '//tkfb.technicalkorea.net/dashboard?redirect=' + encodeURIComponent(window.location.href) + '&_t=' + t; } return window.location.protocol + '//' + hostname + ':30780/dashboard?redirect=' + encodeURIComponent(window.location.href) + '&_t=' + t; }; @@ -153,7 +153,7 @@ if ('serviceWorker' in navigator) { window._loadNotificationBell = function() { var h = window.location.hostname; var s = document.createElement('script'); - s.src = (h.includes('technicalkorea.net') ? 'https://tkds.technicalkorea.net' : window.location.protocol + '//' + h + ':30000') + '/shared/notification-bell.js?v=4'; + s.src = (h.includes('technicalkorea.net') ? 'https://tkfb.technicalkorea.net' : window.location.protocol + '//' + h + ':30000') + '/shared/notification-bell.js?v=4'; document.head.appendChild(s); }; diff --git a/system3-nonconformance/web/static/js/api.js b/system3-nonconformance/web/static/js/api.js index 00ede07..93b5527 100644 --- a/system3-nonconformance/web/static/js/api.js +++ b/system3-nonconformance/web/static/js/api.js @@ -16,7 +16,7 @@ function _getLoginUrl() { const hostname = window.location.hostname; const t = Date.now(); if (hostname.includes('technicalkorea.net')) { - return window.location.protocol + '//tkds.technicalkorea.net/dashboard?redirect=' + encodeURIComponent(window.location.href) + '&_t=' + t; + return window.location.protocol + '//tkfb.technicalkorea.net/dashboard?redirect=' + encodeURIComponent(window.location.href) + '&_t=' + t; } return window.location.protocol + '//' + hostname + ':30000/dashboard?redirect=' + encodeURIComponent(window.location.href) + '&_t=' + t; } diff --git a/system3-nonconformance/web/static/js/app.js b/system3-nonconformance/web/static/js/app.js index 1e39206..5334f8c 100644 --- a/system3-nonconformance/web/static/js/app.js +++ b/system3-nonconformance/web/static/js/app.js @@ -389,7 +389,7 @@ class App { redirectToLogin() { const hostname = window.location.hostname; if (hostname.includes('technicalkorea.net')) { - window.location.href = window.location.protocol + '//tkds.technicalkorea.net/dashboard?redirect=' + encodeURIComponent(window.location.href); + window.location.href = window.location.protocol + '//tkfb.technicalkorea.net/dashboard?redirect=' + encodeURIComponent(window.location.href); } else { window.location.href = window.location.protocol + '//' + hostname + ':30000/dashboard?redirect=' + encodeURIComponent(window.location.href); } @@ -401,7 +401,7 @@ class App { _loadNotificationBell() { var h = window.location.hostname; var s = document.createElement('script'); - s.src = (h.includes('technicalkorea.net') ? 'https://tkds.technicalkorea.net' : window.location.protocol + '//' + h + ':30000') + '/shared/notification-bell.js?v=4'; + s.src = (h.includes('technicalkorea.net') ? 'https://tkfb.technicalkorea.net' : window.location.protocol + '//' + h + ':30000') + '/shared/notification-bell.js?v=4'; document.head.appendChild(s); } diff --git a/system3-nonconformance/web/static/js/components/common-header.js b/system3-nonconformance/web/static/js/components/common-header.js index 5ad4b51..89a2e7e 100644 --- a/system3-nonconformance/web/static/js/components/common-header.js +++ b/system3-nonconformance/web/static/js/components/common-header.js @@ -669,7 +669,7 @@ class CommonHeader { localStorage.removeItem('sso_user'); var hostname = window.location.hostname; if (hostname.includes('technicalkorea.net')) { - window.location.href = window.location.protocol + '//tkds.technicalkorea.net/dashboard'; + window.location.href = window.location.protocol + '//tkfb.technicalkorea.net/dashboard'; } else { window.location.href = window.location.protocol + '//' + hostname + ':30000/dashboard'; } diff --git a/system3-nonconformance/web/static/js/core/auth-manager.js b/system3-nonconformance/web/static/js/core/auth-manager.js index 541c6ff..e5a5e44 100644 --- a/system3-nonconformance/web/static/js/core/auth-manager.js +++ b/system3-nonconformance/web/static/js/core/auth-manager.js @@ -92,7 +92,7 @@ class AuthManager { _getLoginUrl() { const hostname = window.location.hostname; if (hostname.includes('technicalkorea.net')) { - return window.location.protocol + '//tkds.technicalkorea.net/dashboard?redirect=' + encodeURIComponent(window.location.href); + return window.location.protocol + '//tkfb.technicalkorea.net/dashboard?redirect=' + encodeURIComponent(window.location.href); } return window.location.protocol + '//' + hostname + ':30000/dashboard?redirect=' + encodeURIComponent(window.location.href); } diff --git a/tkeg/web/src/config.js b/tkeg/web/src/config.js index a55976f..84060a4 100644 --- a/tkeg/web/src/config.js +++ b/tkeg/web/src/config.js @@ -10,7 +10,7 @@ export const config = { /** SSO 로그인 리다이렉트 URL */ ssoLoginUrl: (redirect) => { const base = isProd - ? `${protocol}//tkds.technicalkorea.net/dashboard` + ? `${protocol}//tkfb.technicalkorea.net/dashboard` : `${protocol}//${hostname}:30000/dashboard`; return redirect ? `${base}?redirect=${encodeURIComponent(redirect)}` : base; }, diff --git a/tkpurchase/web/static/js/tkpurchase-core.js b/tkpurchase/web/static/js/tkpurchase-core.js index 5210ce2..72478d4 100644 --- a/tkpurchase/web/static/js/tkpurchase-core.js +++ b/tkpurchase/web/static/js/tkpurchase-core.js @@ -21,7 +21,7 @@ function getToken() { return _cookieGet('sso_token') || localStorage.getItem('ss function getLoginUrl() { const h = location.hostname; const t = Date.now(); - if (h.includes('technicalkorea.net')) return location.protocol + '//tkds.technicalkorea.net/dashboard?redirect=' + encodeURIComponent(location.href) + '&_t=' + t; + if (h.includes('technicalkorea.net')) return location.protocol + '//tkfb.technicalkorea.net/dashboard?redirect=' + encodeURIComponent(location.href) + '&_t=' + t; return location.protocol + '//' + h + ':30780/dashboard?redirect=' + encodeURIComponent(location.href) + '&_t=' + t; } function decodeToken(t) { try { const b = atob(t.split('.')[1].replace(/-/g,'+').replace(/_/g,'/')); return JSON.parse(new TextDecoder().decode(Uint8Array.from(b, c => c.charCodeAt(0)))); } catch { return null; } } @@ -195,7 +195,7 @@ function initAuth() { /* ===== 알림 벨 ===== */ function _loadNotificationBell() { const s = document.createElement('script'); - s.src = (location.hostname.includes('technicalkorea.net') ? 'https://tkds.technicalkorea.net' : location.protocol + '//' + location.hostname + ':30000') + '/shared/notification-bell.js?v=4'; + s.src = (location.hostname.includes('technicalkorea.net') ? 'https://tkfb.technicalkorea.net' : location.protocol + '//' + location.hostname + ':30000') + '/shared/notification-bell.js?v=4'; document.head.appendChild(s); } diff --git a/tksafety/web/static/js/tksafety-core.js b/tksafety/web/static/js/tksafety-core.js index d5cd167..32b6c29 100644 --- a/tksafety/web/static/js/tksafety-core.js +++ b/tksafety/web/static/js/tksafety-core.js @@ -21,7 +21,7 @@ function getToken() { return _cookieGet('sso_token') || localStorage.getItem('ss function getLoginUrl() { const h = location.hostname; const t = Date.now(); - if (h.includes('technicalkorea.net')) return location.protocol + '//tkds.technicalkorea.net/dashboard?redirect=' + encodeURIComponent(location.href) + '&_t=' + t; + if (h.includes('technicalkorea.net')) return location.protocol + '//tkfb.technicalkorea.net/dashboard?redirect=' + encodeURIComponent(location.href) + '&_t=' + t; return location.protocol + '//' + h + ':30780/dashboard?redirect=' + encodeURIComponent(location.href) + '&_t=' + t; } function decodeToken(t) { try { const b = atob(t.split('.')[1].replace(/-/g,'+').replace(/_/g,'/')); return JSON.parse(new TextDecoder().decode(Uint8Array.from(b, c => c.charCodeAt(0)))); } catch { return null; } } @@ -173,7 +173,7 @@ function initAuth() { /* ===== 알림 벨 ===== */ function _loadNotificationBell() { const s = document.createElement('script'); - s.src = (location.hostname.includes('technicalkorea.net') ? 'https://tkds.technicalkorea.net' : location.protocol + '//' + location.hostname + ':30000') + '/shared/notification-bell.js?v=4'; + s.src = (location.hostname.includes('technicalkorea.net') ? 'https://tkfb.technicalkorea.net' : location.protocol + '//' + location.hostname + ':30000') + '/shared/notification-bell.js?v=4'; document.head.appendChild(s); } diff --git a/tksupport/web/static/js/tksupport-core.js b/tksupport/web/static/js/tksupport-core.js index d7c2057..ac4da07 100644 --- a/tksupport/web/static/js/tksupport-core.js +++ b/tksupport/web/static/js/tksupport-core.js @@ -16,7 +16,7 @@ function getToken() { return _cookieGet('sso_token'); } function getLoginUrl() { const h = location.hostname; const t = Date.now(); - if (h.includes('technicalkorea.net')) return location.protocol + '//tkds.technicalkorea.net/dashboard?redirect=' + encodeURIComponent(location.href) + '&_t=' + t; + if (h.includes('technicalkorea.net')) return location.protocol + '//tkfb.technicalkorea.net/dashboard?redirect=' + encodeURIComponent(location.href) + '&_t=' + t; return location.protocol + '//' + h + ':30780/dashboard?redirect=' + encodeURIComponent(location.href) + '&_t=' + t; } function decodeToken(t) { try { const b = atob(t.split('.')[1].replace(/-/g,'+').replace(/_/g,'/')); return JSON.parse(new TextDecoder().decode(Uint8Array.from(b, c => c.charCodeAt(0)))); } catch { return null; } } @@ -198,7 +198,7 @@ async function _loadPermissions(userId) { /* ===== 알림 벨 ===== */ function _loadNotificationBell() { const s = document.createElement('script'); - s.src = (location.hostname.includes('technicalkorea.net') ? 'https://tkds.technicalkorea.net' : location.protocol + '//' + location.hostname + ':30000') + '/shared/notification-bell.js?v=4'; + s.src = (location.hostname.includes('technicalkorea.net') ? 'https://tkfb.technicalkorea.net' : location.protocol + '//' + location.hostname + ':30000') + '/shared/notification-bell.js?v=4'; document.head.appendChild(s); } diff --git a/user-management/web/static/js/tkuser-core.js b/user-management/web/static/js/tkuser-core.js index c8a4319..86c2c20 100644 --- a/user-management/web/static/js/tkuser-core.js +++ b/user-management/web/static/js/tkuser-core.js @@ -16,7 +16,7 @@ function getToken() { return _cookieGet('sso_token') || localStorage.getItem('ss function getLoginUrl() { const h = location.hostname; const t = Date.now(); // 캐시 버스팅 - if (h.includes('technicalkorea.net')) return location.protocol + '//tkds.technicalkorea.net/dashboard?redirect=' + encodeURIComponent(location.href) + '&_t=' + t; + if (h.includes('technicalkorea.net')) return location.protocol + '//tkfb.technicalkorea.net/dashboard?redirect=' + encodeURIComponent(location.href) + '&_t=' + t; return location.protocol + '//' + h + ':30780/dashboard?redirect=' + encodeURIComponent(location.href) + '&_t=' + t; } function decodeToken(t) { try { const b = atob(t.split('.')[1].replace(/-/g,'+').replace(/_/g,'/')); return JSON.parse(new TextDecoder().decode(Uint8Array.from(b, c => c.charCodeAt(0)))); } catch { return null; } } @@ -211,7 +211,7 @@ async function init() { /* ===== 알림 벨 ===== */ function _loadNotificationBell() { const s = document.createElement('script'); - s.src = (location.hostname.includes('technicalkorea.net') ? 'https://tkds.technicalkorea.net' : location.protocol + '//' + location.hostname + ':30000') + '/shared/notification-bell.js?v=4'; + s.src = (location.hostname.includes('technicalkorea.net') ? 'https://tkfb.technicalkorea.net' : location.protocol + '//' + location.hostname + ':30000') + '/shared/notification-bell.js?v=4'; document.head.appendChild(s); }