*/
public void validateSamlProtocolResponse(final Response response, final ExtendedSAMLMessageContext context,
final SignatureTrustEngine engine) {
if (!isIssueInstantValid(response.getIssueInstant())) {
throw new SamlException("Response issue instant is too old or in the future");
}
// TODO add Destination and inResponseTo Validation
if (response.getIssuer() != null) {
validateIssuer(response.getIssuer(), context);
}
if (!StatusCode.SUCCESS_URI.equals(response.getStatus().getStatusCode().getValue())) {
String status = response.getStatus().getStatusCode().getValue();
if (response.getStatus().getStatusMessage() != null) {
status += " / " + response.getStatus().getStatusMessage().getMessage();
}
throw new SamlException("Authentication response is not success ; actual " + status);
}
if (response.getSignature() != null) {
validateSignature(response.getSignature(), context.getPeerEntityId(), engine);
context.setInboundSAMLMessageAuthenticated(true);