fix: tkfb 로그인을 SSO 인증으로 변경

system1-factory의 자체 로그인 폼을 제거하고 게이트웨이 SSO 로그인 페이지(/login)로
리다이렉트하도록 변경. 기존에는 /api/auth/login(system1-api)으로 직접 인증하여
SSO 사용자가 401 오류를 받았음.

- index.html: 로그인 폼 제거, SSO 토큰 없으면 /login으로 리다이렉트
- api-base.js: getLoginUrl() 개발환경에서도 SSO 로그인 경로 반환
- api-helper.js: authFetch 401/토큰없음 시 SSO 로그인으로 리다이렉트
- app-init.js: 로그아웃 및 인증실패 시 SSO 로그인으로 리다이렉트

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-03-04 14:41:27 +09:00
parent 6e5c29c73a
commit 8fd74ad22f
4 changed files with 112 additions and 174 deletions

View File

@@ -20,9 +20,10 @@
/**
* SSO 토큰 가져오기 (쿠키 우선, localStorage 폴백)
* sso_token이 없으면 기존 token도 확인 (하위 호환)
*/
window.getSSOToken = function() {
return cookieGet('sso_token') || localStorage.getItem('sso_token');
return cookieGet('sso_token') || localStorage.getItem('sso_token') || localStorage.getItem('token');
};
/**
@@ -30,6 +31,10 @@
*/
window.getSSOUser = function() {
var raw = cookieGet('sso_user') || localStorage.getItem('sso_user');
if (!raw) {
// 기존 user 키도 확인 (하위 호환)
raw = localStorage.getItem('user');
}
try { return raw ? JSON.parse(raw) : null; } catch(e) { return null; }
};
@@ -41,7 +46,8 @@
if (hostname.includes('technicalkorea.net')) {
return window.location.protocol + '//tkfb.technicalkorea.net/login?redirect=' + encodeURIComponent(window.location.href);
}
return '/login';
// 개발 환경: 게이트웨이 SSO 로그인 페이지
return '/login?redirect=' + encodeURIComponent(window.location.href);
};
/**
@@ -54,6 +60,9 @@
localStorage.removeItem('sso_token');
localStorage.removeItem('sso_user');
localStorage.removeItem('sso_refresh_token');
// 기존 키도 삭제 (하위 호환)
localStorage.removeItem('token');
localStorage.removeItem('user');
localStorage.removeItem('userPageAccess');
};