I am working on the SP side of things. We have a SAML2 response from an IDP.
It looks something like the example here:
SAML: Why is the certificate within the Signature?
Now I am using OpenSaml2 to parse and process stuff in this xml file.
I need to pull out the certificate from the response and use it as a credential.
Till now I have done this:
Response response = (Response) xmlObject;
SAMLSignatureProfileValidator profileValidator = new
SAMLSignatureProfileValidator();
Signature signature = response.getSignature();
Credential credential = null;
profileValidator.validate(signature);
SignatureValidator validator = new SignatureValidator(credential);
validator.validate(signature);
In the above code the credential is temporarily "null", but I need it to be the public key, which is in the certificate. Any idea how I can do this?
Have been told that opensaml2 has methods like KeyInfoCredentialResolver to help with this but haven't seen an easy implementation of this.