stack/apps/backend/src
Bilal Godil 0e542f72f5 feat(backend): add SAML protocol wrapper around @node-saml/node-saml
Three modules under apps/backend/src/saml/:

- saml.tsx — buildSamlClient (per-connection SAML instance), build
  AuthnRequestUrl (returns URL + extracted requestId for replay
  protection), parseAndVerifyAssertion (signature + audience + clock-skew
  + InResponseTo are all enforced by node-saml), getSpMetadataXml.
  Defines SamlConnectionConfig locally so the wrapper doesn't depend on
  the project-config schema work.

- metadata-parser.tsx — pulls entityId, ssoUrl, and the signing X509
  certificate out of pasted IdP metadata XML. Uses xmldom + xpath rather
  than regex so it handles attribute-order variations across IdPs.

- discovery.tsx — email-domain to connection lookup for the
  signInWithSso({ email }) flow. Iterates the project's connections and
  returns the first whose `domain` matches.

The clock-skew tolerance is set to 60s, matching the e2e test matrix
item #16. The 'wantAssertionsSigned: true' default means an unsigned
assertion is rejected even if the response itself is signed — which is
the safer default per OWASP SAML guidance.
2026-04-29 16:46:22 -07:00
..
app Move internal MCP server to backend, use Mintlify MCP for docs tools (#1389) 2026-04-29 09:45:52 -07:00
auto-migrations Migration tests 2026-02-17 15:58:06 -08:00
lib feat(backend): extract email-merge helper and add SAML account helpers 2026-04-29 16:46:22 -07:00
oauth fix: refresh-token P2025 race with concurrent sign-out (#1372) 2026-04-24 18:44:39 +00:00
private Update submodules 2026-04-20 19:01:16 -07:00
route-handlers Don't override 5xx errors 2026-04-18 19:31:13 -07:00
saml feat(backend): add SAML protocol wrapper around @node-saml/node-saml 2026-04-29 16:46:22 -07:00
utils Backend fallback (cloud run) (#1306) 2026-04-11 00:57:37 +00:00
analytics.tsx Fix event capture 2024-08-14 12:49:35 -07:00
globals.d.ts Split backend and dashboard (#83) 2024-06-18 15:49:31 +02:00
instrumentation.ts Onboarding app & restricted users (#1069) 2026-01-11 17:22:14 -08:00
polyfills.tsx waitUntil Sentry flush is complete 2026-04-18 22:28:02 -07:00
prisma-client.tsx Fix bigint serialization error on tracing 2026-04-18 14:46:03 -07:00
proxy.tsx External db sync (#1036) 2026-02-05 12:04:31 -08:00
s3.tsx session replays (#1187) 2026-02-16 14:15:17 -08:00
smart-router.tsx Move /api/v1 to /api/latest 2025-02-05 17:24:43 -08:00
stack.tsx Email outbox backend (#1030) 2025-12-12 10:26:38 -08:00