* <p>This SAML 1-specific implementation extracts the value of the ResponseAbstractType
* protocol message Recipient attribute.</p>
*
* */
protected String getIntendedDestinationEndpointURI(SAMLMessageContext samlMsgCtx) throws MessageDecodingException {
SAMLObject samlMessage = samlMsgCtx.getInboundSAMLMessage();
String messageDestination = null;
if (samlMessage instanceof ResponseAbstractType) {
ResponseAbstractType response = (ResponseAbstractType) samlMessage;
messageDestination = DatatypeHelper.safeTrimOrNullString(response.getRecipient());
} else if (samlMessage instanceof RequestAbstractType) {
// don't treat as an error, just return null
return null;
} else {
log.error("Invalid SAML message type encountered: {}", samlMessage.getElementQName().toString());
throw new MessageDecodingException("Invalid SAML message type encountered");
}
return messageDestination;
}