OpenSamlAuthenticationProvider.validateSaml2Response auth exception shown below due to mismatch in HttpServletRequest URL and Destination URL in the IDP:
if (StringUtils.hasText(samlResponse.getDestination()) && !recipient.equals(samlResponse.getDestination())) {
throw this.authException("invalid_destination", "Invalid SAML response destination: " + samlResponse.getDestination());
}...
- HttpServletRequest URL is returning the hostname of the app server from which the SAML request originated (localhost:port) rather than the dns name.
- Our app is behind a load balancer.
- We attempted to add a proxyName and proxyHost to the Http Connector in Tomcat. We still had a mismatch in protocol and we're not convinced this is the correct approach.
- This must have been such a common issue that the Spring SAML Extension - which we are NOT using - has a config class to deal with this exact issue.
- I don't think we can use an interceptor because the HttpServletRequest URL is not modifiable.
Wondering if anyone else has dealt with something similar and figured out a solution.