forked from baron/baron-sso
refactor: 보안 정책 준수를 위해 Keto 포트 외부 노출 제거 및 내부 통신으로 변경 #239
This commit is contained in:
@@ -29,18 +29,13 @@ function LoginPage() {
|
||||
return () => window.removeEventListener("message", handleMessage);
|
||||
}, [navigate]);
|
||||
|
||||
const handleSSOLogin = (mode: "popup" | "redirect" = "popup") => {
|
||||
const handleSSOLogin = () => {
|
||||
const userfrontUrl = import.meta.env.USERFRONT_URL || "https://sso.hmac.kr";
|
||||
const callbackUrl = `${window.location.origin}/auth/callback`;
|
||||
|
||||
// 항상 redirect_uri를 포함하여 로그인이 성공하면 콜백 페이지로 오도록 함
|
||||
const loginUrl = `${userfrontUrl}/signin?source=adminfront&redirect_uri=${encodeURIComponent(callbackUrl)}`;
|
||||
|
||||
if (mode === "redirect") {
|
||||
window.location.href = loginUrl;
|
||||
return;
|
||||
}
|
||||
|
||||
const width = 500;
|
||||
const height = 700;
|
||||
const left = window.screen.width / 2 - width / 2;
|
||||
@@ -54,7 +49,6 @@ function LoginPage() {
|
||||
|
||||
if (popup) {
|
||||
setIsLoggingIn(true);
|
||||
// Optional: Polling to detect if popup was closed without login
|
||||
const timer = setInterval(() => {
|
||||
if (popup.closed) {
|
||||
clearInterval(timer);
|
||||
@@ -62,8 +56,7 @@ function LoginPage() {
|
||||
}
|
||||
}, 1000);
|
||||
} else {
|
||||
// If popup blocked, fallback to redirect
|
||||
window.location.href = loginUrl;
|
||||
alert("팝업 차단이 설정되어 있습니다. 팝업 허용 후 다시 시도해 주세요.");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -94,7 +87,7 @@ function LoginPage() {
|
||||
</CardHeader>
|
||||
<CardContent className="pt-4 pb-8 space-y-3">
|
||||
<Button
|
||||
onClick={() => handleSSOLogin("popup")}
|
||||
onClick={handleSSOLogin}
|
||||
className="w-full h-14 text-lg font-semibold flex gap-3 shadow-lg"
|
||||
disabled={isLoggingIn}
|
||||
>
|
||||
@@ -106,20 +99,11 @@ function LoginPage() {
|
||||
) : (
|
||||
<>
|
||||
<ShieldHalf size={22} />
|
||||
팝업창으로 로그인
|
||||
SSO 계정으로 로그인
|
||||
<ExternalLink size={16} className="opacity-50" />
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={() => handleSSOLogin("redirect")}
|
||||
className="w-full h-12 text-base font-medium flex gap-3"
|
||||
disabled={isLoggingIn}
|
||||
>
|
||||
현재 창에서 로그인 (리다이렉트)
|
||||
</Button>
|
||||
|
||||
<p className="mt-6 text-xs text-center text-muted-foreground leading-relaxed">
|
||||
관리자 전역 세션은 보안을 위해 15분간 유지됩니다.<br />
|
||||
|
||||
Reference in New Issue
Block a user