Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SAML "invalid destination" error message should include location, as well as destination #3226

Open
aramprice opened this issue Jan 8, 2025 · 0 comments

Comments

@aramprice
Copy link
Member

When SAML authentication fails because of "invalid destination", because the destination does not match the location (see patch below), the resulting error message does not include the location.

The patch below updates the error message to include the value of location which is being compared against destination.

diff --git a/server/src/main/java/org/cloudfoundry/identity/uaa/provider/saml/OpenSaml4AuthenticationProvider.java b/server/src/main/java/org/cloudfoundry/identity/uaa/provider/saml/OpenSaml4AuthenticationProvider.java
index e484a0f13..b5398e269 100644
--- a/server/src/main/java/org/cloudfoundry/identity/uaa/provider/saml/OpenSaml4AuthenticationProvider.java
+++ b/server/src/main/java/org/cloudfoundry/identity/uaa/provider/saml/OpenSaml4AuthenticationProvider.java
@@ -224,8 +224,8 @@ public final class OpenSaml4AuthenticationProvider implements AuthenticationProv
             String destination = response.getDestination();
             String location = token.getRelyingPartyRegistration().getAssertionConsumerServiceLocation();
             if (StringUtils.hasText(destination) && !destination.equals(location)) {
-                String message = "Invalid destination [" + destination + "] for SAML response [" + response.getID()
-                        + "]";
+                String message = "Invalid destination [%s], location [%s] combo for samle response [%s]"
+                        .formatted(destination, location, response.getID());
                 result = result.concat(new Saml2Error(Saml2ErrorCodes.INVALID_DESTINATION, message));
             }
             String assertingPartyEntityId = token.getRelyingPartyRegistration()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant