From f9ce4b218e0b8f2fd6b01ea7578c56bcc951c818 Mon Sep 17 00:00:00 2001 From: amania-jailbreak Date: Wed, 5 Aug 2026 16:07:10 +0900 Subject: [PATCH] =?UTF-8?q?auth:=20SSO=E3=83=AD=E3=82=B0=E3=82=A4=E3=83=B3?= =?UTF-8?q?=E5=BE=8C=E3=81=AE=E7=94=BB=E9=9D=A2=E9=81=B7=E7=A7=BB=E3=81=A8?= =?UTF-8?q?=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC=E8=A1=A8=E7=A4=BA=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - コールバック成功時のリダイレクト先をWEB_ORIGINルートから /dashboardに変更(ランディングで止まらないように) - ルートページでログイン済みならダッシュボードへ自動遷移 - サイドバーのユーザーカードをOIDC identityの表示名・メールに変更し、 未ログイン時のみSSOログインリンクを表示 - demoヘッダ(x-demo-user)はdemoモード時のみ送信 --- app/lib/dashboard.ts | 4 +++- app/page.tsx | 16 +++++++++++++++- apps/api/src/auth.ts | 3 ++- components/altdock/admin-shell.tsx | 21 +++++++++++++++++++-- 4 files changed, 39 insertions(+), 5 deletions(-) diff --git a/app/lib/dashboard.ts b/app/lib/dashboard.ts index b185e92..a39d3fb 100644 --- a/app/lib/dashboard.ts +++ b/app/lib/dashboard.ts @@ -41,7 +41,9 @@ export async function api(path: string, init: RequestInit = {}) { const headers = new Headers(init.headers); headers.set("accept", "application/json"); if (init.body) headers.set("content-type", "application/json"); - Object.entries(DEMO_HEADERS).forEach(([key, value]) => headers.set(key, value)); + if (AUTH_MODE === "demo") { + Object.entries(DEMO_HEADERS).forEach(([key, value]) => headers.set(key, value)); + } const response = await fetch(`${API_BASE}${path}`, { ...init, headers, credentials: "include" }); const body = (await response.json().catch(() => ({}))) as T & { error?: string; detail?: string }; if (!response.ok) throw new Error(body.detail || body.error || `Request failed (${response.status})`); diff --git a/app/page.tsx b/app/page.tsx index 80dbbde..dd326c5 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,10 +1,24 @@ "use client"; +import { useEffect } from "react"; import Link from "next/link"; +import { useRouter } from "next/navigation"; import { ArrowRight, Boxes, FileArchive, Gauge, KeyRound, ShieldCheck, UploadCloud } from "lucide-react"; import { AUTH_MODE, API_BASE } from "@/app/lib/dashboard"; export default function Home() { + const router = useRouter(); + + // SSOモードでログイン済みなら、ランディングを挟まずダッシュボードへ向かう。 + useEffect(() => { + if (AUTH_MODE !== "oidc") return; + let cancelled = false; + fetch(`${API_BASE}/api/v1/me`, { credentials: "include" }) + .then((response) => { if (response.ok && !cancelled) router.replace("/dashboard"); }) + .catch(() => {}); + return () => { cancelled = true; }; + }, [router]); + return
AAltDockBETA @@ -24,7 +38,7 @@ export default function Home() { ダッシュボードを開く 配布要件を見る -
Demo mode で起動中 · API {API_BASE}
+ {AUTH_MODE === "demo" &&
Demo mode で起動中 · API {API_BASE}
}