saml post

This commit is contained in:
Max Peintner
2025-06-24 15:29:58 +02:00
parent 9c7ea795a2
commit 4844731ee0
2 changed files with 17 additions and 5 deletions

View File

@@ -215,11 +215,24 @@ export async function GET(request: NextRequest) {
new URLSearchParams(params),
},
}).then((resp) => {
if (
resp.nextStep.value &&
typeof resp.nextStep.value === "string"
) {
if (resp.nextStep.case === "authUrl" && resp.nextStep.value) {
return NextResponse.redirect(resp.nextStep.value);
} else if (
resp.nextStep.case === "postForm" &&
resp.nextStep.value
) {
const postCall = resp.nextStep.value;
const redirectUrl = constructUrl(request, "/saml-post");
redirectUrl.searchParams.set("url", url);
redirectUrl.searchParams.set("RelayState", postCall.relayState);
redirectUrl.searchParams.set(
"SAMLResponse",
postCall.samlResponse,
);
return NextResponse.redirect(redirectUrl.toString());
}
});
}

View File

@@ -962,7 +962,6 @@ export async function startIdentityProviderFlow({
urls,
}: {
serviceUrl: string;
idpId: string;
urls: RedirectURLsJson;
}) {