fix(login): refactor SAML Post Flow to bypass cookie limits, fix SAML SP post (#11170)

Closes #10816
Closes #10759

# Which Problems Are Solved

This PR refactors the SAML Post binding flow to address issues with
payloads exceeding browser cookie size limits (typically ~4KB).
Previously, the SAML form data was serialized into a cookie, and the
user was redirected to an intermediate /saml-post page to render the
form. This approach failed for large SAML assertions.

# How the Problems Are Solved

The new implementation bypasses cookies entirely for the payload
transfer. Server actions now return the form data directly to the
client, which immediately renders and submits the form.

- Direct Data Transfer: Updated `startIdentityProviderFlow` to return an
object { url, fields } instead of a redirect URL when the next step is
formData.
- Server Actions: Updated redirectToIdp, sendLoginname, and
completeAuthFlow to propagate this samlData object to the client.
- Client-Side Auto-Submission: Added a new AutoSubmitForm component that
renders a hidden form with the provided fields and automatically submits
it to the IdP on mount.

---------

Co-authored-by: conblem <[email protected]>
This commit is contained in:
Max Peintner
2026-02-09 13:46:30 +01:00
committed by GitHub
co-authored by conblem
parent 6f4f54708e
commit 9492c12c09
36 changed files with 891 additions and 1454 deletions
+11
View File
@@ -208,6 +208,9 @@ importers:
deepmerge:
specifier: ^4.3.1
version: 4.3.1
escape-html:
specifier: ^1.0.3
version: 1.0.3
lucide-react:
specifier: ^0.562.0
version: 0.562.0([email protected])
@@ -272,6 +275,9 @@ importers:
'@testing-library/react':
specifier: ^16.3.1
version: 16.3.2(@testing-library/[email protected])(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
'@types/escape-html':
specifier: ^1.0.4
version: 1.0.4
'@types/node':
specifier: ^22.19.3
version: 22.19.7
@@ -4903,6 +4909,9 @@ packages:
'@types/[email protected]':
resolution: {integrity: sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==}
'@types/[email protected]':
resolution: {integrity: sha512-qZ72SFTgUAZ5a7Tj6kf2SHLetiH5S6f8G5frB2SPQ3EyF02kxdyBFf4Tz4banE3xCgGnKgWLt//a6VuYHKYJTg==}
'@types/[email protected]':
resolution: {integrity: sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==}
@@ -16206,6 +16215,8 @@ snapshots:
dependencies:
'@types/ms': 2.1.0
'@types/[email protected]': {}
'@types/[email protected]':
dependencies:
'@types/eslint': 9.6.1