This commit is contained in:
Max Peintner
2025-02-05 11:33:21 +01:00
parent 9516a3a59a
commit 7a83345428
2 changed files with 28 additions and 0 deletions

View File

@@ -10,6 +10,7 @@ import {
getActiveIdentityProviders, getActiveIdentityProviders,
getAuthRequest, getAuthRequest,
getOrgsByDomain, getOrgsByDomain,
getSAMLRequest,
listSessions, listSessions,
startIdentityProviderFlow, startIdentityProviderFlow,
} from "@/lib/zitadel"; } from "@/lib/zitadel";
@@ -432,6 +433,13 @@ export async function GET(request: NextRequest) {
} }
} else if (requestId && requestId.startsWith("saml_")) { } else if (requestId && requestId.startsWith("saml_")) {
// handle saml request // handle saml request
const { samlRequest } = await getSAMLRequest({
serviceUrl,
serviceRegion,
samlRequestId: requestId.replace("saml_", ""),
});
samlRequest?.
} else { } else {
return NextResponse.json( return NextResponse.json(
{ error: "No authRequest nor samlRequest provided" }, { error: "No authRequest nor samlRequest provided" },

View File

@@ -1034,6 +1034,26 @@ export async function createCallback({
return oidcService.createCallback(req); return oidcService.createCallback(req);
} }
export async function getSAMLRequest({
serviceUrl,
serviceRegion,
samlRequestId,
}: {
serviceUrl: string;
serviceRegion: string;
samlRequestId: string;
}) {
const samlService = await createServiceForHost(
SAMLService,
serviceUrl,
serviceRegion,
);
return samlService.getSAMLRequest({
samlRequestId,
});
}
export async function createResponse({ export async function createResponse({
serviceUrl, serviceUrl,
serviceRegion, serviceRegion,