[PR #8805] feat(sso): support multiple IDP signing certificates #25126

Open
opened 2026-04-15 22:44:00 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8805
Author: @OscarCornish
Created: 3/27/2026
Status: 🔄 Open

Base: mainHead: feat/sso-multiple-idp-cert-support


📝 Commits (2)

  • cea3ca6 feat(sso): Support multiple IDP signing certificates
  • 9b201ab add changeset

📊 Changes

5 files changed (+144 additions, -5 deletions)

View changed files

.changeset/heavy-planes-remain.md (+5 -0)
📝 packages/sso/src/providers.test.ts (+127 -0)
📝 packages/sso/src/routes/providers.ts (+8 -1)
📝 packages/sso/src/routes/schemas.ts (+2 -2)
📝 packages/sso/src/types.ts (+2 -2)

📄 Description

With SAML IDPs, the metadata.xml document is live - they can rotate certificates.

When rotating certificates, there is a time when the metadata will reference signing certificates - BA currently only supports an IDP having a single signing cert, but the underlying library (samlify) does, so simply need to update the types & parsing.

This PR:

  • Adds the string[] type to certs
  • Adds tests for the parsing of multiple certs

Summary by cubic

Adds support for multiple IdP signing certificates in SAML SSO to handle certificate rotation. Accepts one or many certs, validates non-empty arrays, and returns clear errors.

  • New Features

    • SAMLConfig.cert and SAMLConfig.idpMetadata.cert now accept string | string[] (schema enforces non-empty arrays).
    • Provider read endpoint normalizes input, parses all certs, and returns samlConfig.certificate as an object for a single cert or an array for multiple; returns { error: "No certificates provided" } or { error: "Failed to parse certificate" } on errors. Tests cover multi/single parsing, SHA-256 fingerprints, and object-vs-array shape.
  • Migration

    • No changes needed for existing single-cert configs.
    • Clients should handle samlConfig.certificate being an object or an array.

Written for commit 9b201ab2da. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/8805 **Author:** [@OscarCornish](https://github.com/OscarCornish) **Created:** 3/27/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/sso-multiple-idp-cert-support` --- ### 📝 Commits (2) - [`cea3ca6`](https://github.com/better-auth/better-auth/commit/cea3ca65b0d92d6f3bd71ffe1fea3464b8e1e601) feat(sso): Support multiple IDP signing certificates - [`9b201ab`](https://github.com/better-auth/better-auth/commit/9b201ab2da3a28b4970c5f91df27fa7b921d4a32) add changeset ### 📊 Changes **5 files changed** (+144 additions, -5 deletions) <details> <summary>View changed files</summary> ➕ `.changeset/heavy-planes-remain.md` (+5 -0) 📝 `packages/sso/src/providers.test.ts` (+127 -0) 📝 `packages/sso/src/routes/providers.ts` (+8 -1) 📝 `packages/sso/src/routes/schemas.ts` (+2 -2) 📝 `packages/sso/src/types.ts` (+2 -2) </details> ### 📄 Description With SAML IDPs, the metadata.xml document is live - they can rotate certificates. When rotating certificates, there is a time when the metadata will reference signing certificates - BA currently only supports an IDP having a single signing cert, but the underlying library (samlify) does, so simply need to update the types & parsing. This PR: - Adds the `string[]` type to certs - Adds tests for the parsing of multiple certs <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds support for multiple IdP signing certificates in SAML SSO to handle certificate rotation. Accepts one or many certs, validates non-empty arrays, and returns clear errors. - **New Features** - `SAMLConfig.cert` and `SAMLConfig.idpMetadata.cert` now accept `string | string[]` (schema enforces non-empty arrays). - Provider read endpoint normalizes input, parses all certs, and returns `samlConfig.certificate` as an object for a single cert or an array for multiple; returns `{ error: "No certificates provided" }` or `{ error: "Failed to parse certificate" }` on errors. Tests cover multi/single parsing, SHA-256 fingerprints, and object-vs-array shape. - **Migration** - No changes needed for existing single-cert configs. - Clients should handle `samlConfig.certificate` being an object or an array. <sup>Written for commit 9b201ab2da3a28b4970c5f91df27fa7b921d4a32. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-15 22:44:00 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#25126