diff --git a/App/.env.example b/App/.env.example index bc10979..4d7757b 100644 --- a/App/.env.example +++ b/App/.env.example @@ -15,6 +15,14 @@ NEXTAUTH_SECRET=your-32-char-secret-here-generate-with-openssl NEXTAUTH_URL=http://localhost:3000 +# ── Microsoft Entra ID (Azure AD) SSO ──────────────────────── +# Register an app at https://entra.microsoft.com +# Required redirect URI: {NEXTAUTH_URL}/api/auth/callback/microsoft-entra-id +# Grant: openid, profile, email (Microsoft Graph delegated permissions) +AZURE_AD_CLIENT_ID=your-azure-app-client-id +AZURE_AD_CLIENT_SECRET=your-azure-app-client-secret +AZURE_AD_TENANT_ID=your-azure-tenant-id + # ── Database ────────────────────────────────────────────────── # Local PostgreSQL or Supabase DATABASE_URL="postgresql://postgres:postgres@localhost:5432/pelagia_portal" diff --git a/App/app/(auth)/login/login-form.tsx b/App/app/(auth)/login/login-form.tsx index cfea2b5..cb10352 100644 --- a/App/app/(auth)/login/login-form.tsx +++ b/App/app/(auth)/login/login-form.tsx @@ -9,10 +9,16 @@ export function LoginForm() { const [password, setPassword] = useState(""); const [error, setError] = useState(""); const [loading, setLoading] = useState(false); + const [ssoLoading, setSsoLoading] = useState(false); const router = useRouter(); const searchParams = useSearchParams(); const callbackUrl = searchParams.get("callbackUrl") ?? "/dashboard"; + async function handleSso() { + setSsoLoading(true); + await signIn("microsoft-entra-id", { callbackUrl }); + } + async function handleSubmit(e: React.FormEvent) { e.preventDefault(); setLoading(true); @@ -34,58 +40,90 @@ export function LoginForm() { } return ( -