fix: saml attributes for form post

This commit is contained in:
Stefan Benz
2025-03-12 10:08:14 +01:00
parent b90a0c31c1
commit 9bbbd965ed

View File

@@ -477,17 +477,17 @@ export async function GET(request: NextRequest) {
} else if (url && binding.case === "post") { } else if (url && binding.case === "post") {
// Create form data after SAML standard // Create form data after SAML standard
const formData = { const formData = {
"RelayState": binding.value.relayState, RelayState: binding.value.relayState,
"SAMLResponse": binding.value.samlResponse, SAMLResponse: binding.value.samlResponse,
}; };
// Convert form data to URL-encoded string // Convert form data to URL-encoded string
const formBody = Object.entries(formData) const formBody = Object.entries(formData)
.map( .map(
([key, value]) => ([key, value]) =>
encodeURIComponent(key) + "=" + encodeURIComponent(value), encodeURIComponent(key) + "=" + encodeURIComponent(value),
) )
.join("&"); .join("&");
// Make a POST request to the external URL with the form data // Make a POST request to the external URL with the form data
const response = await fetch(url, { const response = await fetch(url, {