I have a SAML 2 response with one assertion which is signed and the response itself has signed again. I use below code to validate the signature profile of the response.
SAMLSignatureProfileValidator signatureProfileValidator = new SAMLSignatureProfileValidator();
signatureProfileValidator.validate(response.getSignature());
And below code block to validate signature.
SignatureValidator signatureValidator = new SignatureValidator(validatingCredential);
signatureValidator.validate(response.getSignature());
But I believe that these things validate the response signature and the response signature profile only. Do I need to validate the assertion signature as well? I have tried validating assertion signature using below code block. But it gives me the ValidationException which means it is not valid. But it should be.
SignatureValidator signatureValidator = new SignatureValidator(validatingCredential);
signatureValidator.validate(assertion.getSignature());