From 8ea1061fb12ca64beb9e4d2eb1a605496716efc2 Mon Sep 17 00:00:00 2001 From: Ulysse Carion Date: Thu, 24 Oct 2024 09:16:53 -0700 Subject: [PATCH] Add HTTP-Redirect binding to app metadata (#11) This PR adds a HTTP-Redirect binding to the metadata for apps. The login page already implements that binding, so this PR just uses that as the HTTP-Redirect location. Closes #10. --- src/app/app.ts | 4 ++++ src/app/apps/[id]/metadata/route.ts | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/app/app.ts b/src/app/app.ts index 910aa7a..93e46a6 100644 --- a/src/app/app.ts +++ b/src/app/app.ts @@ -24,3 +24,7 @@ export function appIdpRedirectUrl(app: App): string { export function appIdpMetadataUrl(app: App): string { return `https://${process.env.DUMMYIDP_CUSTOM_DOMAIN || process.env.VERCEL_URL}/apps/${app.id}/metadata`; } + +export function appLoginUrl(app: App): string { + return `https://${process.env.DUMMYIDP_CUSTOM_DOMAIN || process.env.VERCEL_URL}/apps/${app.id}/login`; +} diff --git a/src/app/apps/[id]/metadata/route.ts b/src/app/apps/[id]/metadata/route.ts index 48464a0..b1cdf11 100644 --- a/src/app/apps/[id]/metadata/route.ts +++ b/src/app/apps/[id]/metadata/route.ts @@ -1,6 +1,6 @@ import { NextRequest, NextResponse } from "next/server"; import { getApp } from "@/app/actions"; -import { appIdpEntityId, appIdpRedirectUrl } from "@/app/app"; +import { appIdpEntityId, appIdpRedirectUrl, appLoginUrl } from "@/app/app"; import { INSECURE_PUBLIC_CERTIFICATE } from "@/lib/insecure-cert"; export async function GET( @@ -30,6 +30,7 @@ export async function GET( urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress + `, {