diff --git a/apps/login/src/app/(login)/saml-post/page.tsx b/apps/login/src/app/(login)/saml-post/page.tsx new file mode 100644 index 0000000000..bc62efa3b4 --- /dev/null +++ b/apps/login/src/app/(login)/saml-post/page.tsx @@ -0,0 +1,45 @@ +"use client"; + +import { useSearchParams } from "next/navigation"; +import { useEffect } from "react"; + +export default function SamlPost() { + const searchParams = useSearchParams(); + + const url = searchParams.get("url"); + const relayState = searchParams.get("RelayState"); + const samlResponse = searchParams.get("SAMLResponse"); + + console.log(relayState, samlResponse); + + useEffect(() => { + // Automatically submit the form after rendering + const form = document.getElementById("samlForm") as HTMLFormElement; + if (form) { + form.submit(); + } + }, []); + + if (!url || !relayState || !samlResponse) { + return ( +
Missing required parameters for SAML POST.
+ ); + } + + return ( + + + + +Redirecting...
+ + + ); +} diff --git a/apps/login/src/app/login/route.ts b/apps/login/src/app/login/route.ts index 6f97f4d638..a3f1108778 100644 --- a/apps/login/src/app/login/route.ts +++ b/apps/login/src/app/login/route.ts @@ -473,43 +473,17 @@ export async function GET(request: NextRequest) { if (url && binding.case === "redirect") { return NextResponse.redirect(url); } else if (url && binding.case === "post") { - // Create form data after SAML standard const formData = { RelayState: binding.value.relayState, SAMLResponse: binding.value.samlResponse, }; - const formHtml = ` - - - - - -