Skip to content

Commit

Permalink
saml req
Browse files Browse the repository at this point in the history
  • Loading branch information
peintnermax committed Feb 5, 2025
1 parent 9516a3a commit 7a83345
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
8 changes: 8 additions & 0 deletions apps/login/src/app/login/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
getActiveIdentityProviders,
getAuthRequest,
getOrgsByDomain,
getSAMLRequest,
listSessions,
startIdentityProviderFlow,
} from "@/lib/zitadel";
Expand Down Expand Up @@ -432,6 +433,13 @@ export async function GET(request: NextRequest) {
}
} else if (requestId && requestId.startsWith("saml_")) {
// handle saml request
const { samlRequest } = await getSAMLRequest({
serviceUrl,
serviceRegion,
samlRequestId: requestId.replace("saml_", ""),
});

samlRequest?.
} else {
return NextResponse.json(
{ error: "No authRequest nor samlRequest provided" },
Expand Down
20 changes: 20 additions & 0 deletions apps/login/src/lib/zitadel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,26 @@ export async function createCallback({
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({
serviceUrl,
serviceRegion,
Expand Down

0 comments on commit 7a83345

Please sign in to comment.