Skip to content

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

21 linesCodeBlameRaw
1import { ssoAddresses } from "@g1t/contracts";
2
3import type { Route } from "./+types/auth-sso-metadata";
4import { sso } from "../lib/sso.server";
5
6/**
7 * g1t's SAML service provider metadata for a workspace, for its identity
8 * provider to read: the entity id (this address) and where to post the
9 * response. The same for everyone; it says nothing about the workspace.
10 */
11export async function loader({ request, params }: Route.LoaderArgs) {
12 const addresses = ssoAddresses(new URL(request.url).origin, params.owner);
13 const xml = await sso.metadata(addresses.entityId, addresses.acsUrl);
14 return new Response(xml, {
15 headers: {
16 "content-type": "application/samlmetadata+xml; charset=utf-8",
17 "cache-control": "public, max-age=3600",
18 "content-disposition": `inline; filename="g1t-${params.owner.toLowerCase()}-metadata.xml"`,
19 },
20 });
21}